[swift-evolution] Proposal: Add .times method to Integer type

Tino Heth 2th at gmx.de
Sun Dec 20 05:09:19 CST 2015


I guess everyone agrees that it is easy to add the functionality with an extension — and I'm quite sure many will do so.
For me, the need to add the method on my own (if I want to use it) is not an issue, but imho having several thousand implementations of the same concept isn't that appealing.
Tiny methods like "times" should be inlined anyways, so it actually doesn't matter, but for types and bigger functions, standardization would be a good thing:
C++ for example might have seen many thousand incompatible implementations of basic concepts like "point", "vector", "either" or "picture", most of them nearly identical and only created because there was nothing to build on.
It is a bad idea to put every possible concept into the standard lib, which imho should be as small and compact as possible, but looking at C++ again, there is boost…

So for me it would make sense to have a set of "semi"-standard libs to ensure that there is some consensus on common datatypes (especially protocols).
Right now, the Cocoa libs help us with things like CGSize, NSDate and UIImage, but I think this fundament is not the best choice for Swift on other platforms.

How about proposing to start adding some more official git-repositories for libs? That would be a much bigger thing than adding "Int.times", but as with boost, it could easily evolve alongside core Swift.

Tino


More information about the swift-evolution mailing list