[Swift-devel] Standard library

Mihael Hategan hategan at mcs.anl.gov
Fri Jan 9 22:05:43 CST 2015


Hi,

I compiled a list of functions in both K and T with comments here:
https://trac.ci.uchicago.edu/swift/wiki/StandardLibrary

Feel free to edit.

I think that both T and K are at about the same level of quality in
terms of naming consistency (within their own group of functions),
completeness, and functional consistency, with T getting slightly more
points.

In other words I think that both need work. Here's a list of things that
are quickly obvious:

- CamelCase vs. nothinginparticular vs. under_score: the real problem
here is that, aside from the one in the middle, none is better than the
other, and I favor CamelCase while Tim and Justin will probably not want
to let go of the underscores. Maybe. I doubt either of us care that
much. But let's not fall into the trap of debating it.

- Overloading. While I don't think either T or K support user-defined
polymorphic functions, they both seem to support it for library
functions to some extent. I am of the opinion that a strongly typed
language *should* make use of polymorphism. And that we should
eventually allow users to overload functions.

- exp(), pow(), etc., but no sin(), cos(), tan(), arcx() (K has none of
these)

- no regexps in T, no non-regexp split in K.

- no toLower toUpper in either.

- very few (if any) array functions, such as slices, join, split,
search, etc.

The situation is understandable. Swift's (both of them) war has been on
other fronts. But I do not think, at this point, that the solution lies
in either adopting what the other does and calling it a day. I think
that both can get a better set of standard functions and that we can
work together to come up (where necessary) with basically the same set
of things.

In doing so, I think what MIke said made sense: pick a decent language
and mirror what it does, though I suspect that it will not necessarily
be easy to agree on such a language.

Mihael




More information about the Swift-devel mailing list