Hacker News new | comments | show | ask | jobs | submit login
Steve Jobs on Swift (metaobject.com)
10 points by mpweiher 956 days ago | hide | past | web | favorite | 4 comments



I'm going through half of Swift's ebook rewriting an old objc program in the process and the amount of syntax special cases is just mind boggling. So far the worst offender to me feels the use of the where keyword inside branched let assignments. Example: ``if let a = optionalValue where a.someFieldString = "hello" { ... }``. In general the ``where`` keyword signals they ran out of ideas designing the language.


So, at this point, what's your take on the language, as compared to Objective-C?


It's definitely an improvement, but most of the syntax complexity seems to come precisely from supporting all the annoyances of Objective-C.

The feature I most miss from other programming languages like Nim is meta programming. In Objective-C you had synthesized properties to generate all the boilerplate code, but in Swift you don't, so to copy certain Objective-C patterns you have to manually write your own private instance variable plus a computed property to control access and side effects. Stuff which is trivially hidden behind a macro. Come on, even Java allows use of annotations to generate code at compile time on Android.

Of course you can argue then that maybe Swift code should not use Objective-C patterns, but hey, I'm still porting and learning. And maybe Swift 2 by the end of the year will have this feature, just like the usage of the where keyword inside conditionals was added recently in 1.2.

I also dislike that there are no forward declarations, so instead of being able to put all your class public API in a single block you have to mingle it with setter/getters' implementations. I guess it's time to use a documentation generation tool and read that instead of reading header files.


I'm actually intrigued, what you'd propose as an alternative. A lisp? A smalltalk? Dylan? or even something like Factor?

The goal of swift seems to nudge programmers further down the immutable, functional path, while still giving them the impression of staying away from the scary FP stuff.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: