Live data from Hacker News

The Swift Programming Language

developer.apple.com

241–250 of 970 posts

Re: The Swift Programming Language

#242

So it looks like the language isn't open source and won't target non-Apple runtimes? I'm not trying to troll, I just think that it's a pity that Apple tends to limit the ecosystem and applications of its otherwise-great languages. Building against LLVM ought to make it fairly trivial to make this cross-platform.

Combine this with their OpenGL replacement ("Metal") and that pretty much kills any cross-platform at all doesn't it?

Re: The Swift Programming Language

#243

Feels like they looked at a bunch of programming languages, took all their favorite features, and then put them into one which still sits on top of the ObjC runtime. And then added some Apple syntactic craziness. For example: var apples = 3; // mutable let oranges = 5; // immutable let summary = "I have \(apples) apples and \(oranges) oranges";

You say "Apple syntactic craziness", but "var" is identical to JS, et. al. and "let" is identical to ML, et. al. The string interpolation syntax is unique, but kind of makes since given then \ is the escape character in C strings.

And "let" will have a totally different meaning in ES6. It's a bit weird to use a keyword from some language with the same meaning, and another keyword from the same language but with a totally different meaning.

Re: The Swift Programming Language

#245

Feels like they looked at a bunch of programming languages, took all their favorite features, and then put them into one which still sits on top of the ObjC runtime. And then added some Apple syntactic craziness. For example: var apples = 3; // mutable let oranges = 5; // immutable let summary = "I have \(apples) apples and \(oranges) oranges";

Alternative viewpoint based purely on your three lines (I can't seem to get to the reference manual...) - all of those seem like pretty good design decisions. To me, "var" sounds like it makes something that is variable and "let" sounds like it is creating an equivalence. The "\(foo)" syntax actually looks really clean to me, though I can't recall having seen anyone use it for that before.

Re: The Swift Programming Language

#246
Swift has a built in option type

“if let actualNumber = possibleNumber.toInt() {

    println("\(possibleNumber)  value: \ (actualNumber)")
} else {

    println("\(possibleNumber) could not be converted to an integer")
}”

Nice to see the Apple's language developers embracing functional programming by providing a clean implementation of the Maybe Monad as well as support for closures.

Re: The Swift Programming Language

#249
post #217

Earlier quoted context omitted.

Now that Microsoft has been open sourcing so much stuff I was expecting Apple to follow the wave and release Swift as open source too. It's a shame though.

I'm old enough to remember Apple suing Microsoft for "copying their look and feel". Open source is something Apple only does strategically - when they have to or it suits them - it is not part of the company's ethos. http://en.wikipedia.org/wiki/Apple_Computer,_Inc._v._Microso... .

[deleted]
Post reply on HN