2 ms·
It's not "one perceived limitation" though. You work with Swift enough, you start tripping over things like this on a regular basis. I think I've had "Oh this
by JimDabell 12y ago
It's not "one perceived limitation" though. You work with Swift enough, you start tripping over things like this on a regular basis. I think I've had "Oh this isn't implemented yet… wait, my workaround isn't implemented either!" dance several times.
They aren't limitations by design. They are just things that the Swift team haven't gotten around to doing yet. Take a look at some of the messages from Apple engineers tracked by Swift in Flux [0], for example. It's full of things like:
> Optional methods in protocols are limited to @objc protocols only because we haven't implemented them in native protocols yet. This is something we plan to support.
…and:
> > [Is there any] specific reason why you can't reference initializers like a function?
> No particular reason, it's just not implemented.
…and:
> We currently have limitations in the type system and implementation that force some things (e.g. countElements and many others) to be global functions instead of methods, but we consider this a deficiency, not a feature.
…and:
> The prevalence of generic free functions is more about current language limitations than an intentional stylistic direction
It's a good language, but it's terribly unfinished. Back when Swift was in beta, things like this were to be expected, but Swift 1.2 feels more like Swift 0.2 to me. Apple are filling in the missing parts, but at the rate they are going, it will probably only end up feeling like a complete language at next year's WWDC.
[0] https://github.com/ksm/SwiftInFlux https://github.com/ksm/SwiftInFlux