Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Swift seems to be a very pragmatic language. It borrow and learn heavily from other languages, but it doesn't try to be promise anything big. It just introduce opinionated defaults which is safe and tends to be at least 80% of the implementor's intend, while providing alternative for the 20%.

An example is the switch case fall through behaviour of C. In Swift, by default, switch case no longer fall through, but if you need that behaviour, you can always add fallthrough keyword at the end.

When you think about the above behaviour, it seems so much more natural, and wonder why we have been keeping ourselves bitten by this C language construct and developing muscle memory to prevent it by having break, sometimes with a scope (All cases in a switch scare the same scope within C switch, if I don't remember wrongly).

Part of the switch example is solved in other languages (default intends and scoping), of course. But the subtlety of the fallthrough keyword gave me a strong impression. It felt that it should always be a opt-in all these while, rather than an opt-out as it have always been.

With my limited command of english, I feels that I would do it little justice to the language trying to explains some of its concepts like optionals & mutability hints. Some of these concepts only modify the existing solution only so slightly, but meaningful enough to be impactful.

It also doesn't take a stance in the OO and functional debates. It is both OO and functional. Staying as pragmatic as possible.

Finally, Swift is like a wolf hiding under the sheep's skin. Its a very very strongly typed language. It is very specific about it type. But half the time, you can ignore the type and write it like python or ruby. The magic was type inference, its kinda weird but I like that.

You can almost feel that Chris Lattner might have felt he is reaching the point of diminishing return while optimising LLVM for Objective-C. after all, this is a very old language. He done a great job all these while with LLVM but sometimes, the problem is something deeper. Swift is kinda like Objective-C 3.0 without the backward compatibility.

(P.S. Objective-C is my favourite language before Swift)

If programming language is a sword, Swift is just another sword, albeit one that's very sharp.



Go already has the same switch behavior (plus the fallthrough keyword) and is very specific about its types while having type inference.


Thanks! I didn't know that. Its truly interesting that many of our languages is evolving and converging.


haha these answers are cracking me up. Who cares? Do people develop iPhone apps using Go? Swift never claimed to invent new paradigms that didn't exist in other languages, it simply brought them to Cocoa.


My comment was specific to lxcid's comment and his surprise to see all these features in a language. I don't understand why my reply got downvoted.

> Who cares? Do people develop iPhone apps using Go?

There is no built-in support for people to start caring in the first place anyway. But Go fundamentally is better suited for server-side code rather than applications as Swift is supposed to.

On a different note, Apple has started hiring Go engineers. But who cares huh? https://jobs.apple.com/us/search?jobFunction=MTLMF#&ss=33773...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: