4 ms·
On the flipside, it could be that Apple is laying the groundwork (as they tend to do) to evolve these more advanced features into the language. One could imagin
by gfodor 12y ago
On the flipside, it could be that Apple is laying the groundwork (as they tend to do) to evolve these more advanced features into the language. One could imagine Swift becoming quite divergent from Objective-C in the future, but for the initial release it would have been foolish for any number of reasons to try to introduce anything other than a small step forward from Objective-C.
- mpweiher 12y agoYes, I was hoping for this as well, and yes, taking it in small steps is probably the right approach. Alas, the steps Swift is taking all seem to be going in the opposite direction: more compile-time, more strictness, less dynamicism. As has been written before: Swift is not a better Objective-C, it is a better C++. I really hope I am wrong about this, but given the current direction, the expressed philosophy and values as well as the predilections of the people involved, I don't see the direction changing from the initial vector.
- gress 12y agoThere is no less dynamicism in swift than in objective-c. What there is, is a replacement for the C. Which is precisely what they said they were going to do. C, of course is not dynamic, and the replacement is not either. I'm not disputing the idea that instead of replacing the C, Swift's designers could have focussed on enhancing the message passing component, but I would argue that doing so without also replacing the C would have been a mistake. Perhaps the dynamic elements will also be overhauled over time.
- mpweiher 12y ago>There is no less dynamicism in swift than in objective-c. Huh? "Requiring dynamic dispatch is rarely necessary." "The bad news is that, by default, your objects will no longer work with KVO or swizzling. If the designer of a class doesn’t anticipate a reason for a particular method or property to be dynamic, that lack of foresight gets baked in at compile time." etc. See http://mjtsai.com/blog/2014/08/18/its-a-coup/ http://mjtsai.com/blog/2014/08/18/its-a-coup/ If that is not correct, I'd love to hear about it! > Swift's designers could have focussed on enhancing the message passing component, That would have been great. > doing so without also replacing the C would have been a mistake. Absolutely. But really they've replaced the "Objective" and enhanced the C. After all, Objective-C is a blend of Smalltalk and C. If you remove the C, what is left? >Perhaps the dynamic elements will also be overhauled over time. Maybe. So far, that "overhaul" seems to be mostly de-emphasis, deprecation and removal. :-(
- gress 12y agoSwizzling can't be mentioned with a straight face in an argument about brittleness. But, I'll concede that KVO won't work with arbitrary properties of binary libraries you receive or that Apple builds into the platform, assuming they use swift and choose not to mark them dynamic. So in this sole regard, swift is less dynamic. I guess it remains to be seen whether this actually becomes a problem.