Live data from Hacker News

The Swift Programming Language

developer.apple.com

431–440 of 970 posts

Re: The Swift Programming Language

#432
post #2

As someone who always disliked Objective C, I think Swift looks very promising. I'll check it out right away :) Software-wise, I feel these current WWDC announcements are the most exciting in years. Looking at the Swift docs right now, I can see many interesting inspirations at work: there's some Lua/Go in there (multiple return values), some Ruby (closure passed as the last argument to a function can appear immediat…

I really don't see the Golang influence at all. The multiple- return- value semantic is closer to Ruby's than to Golang's; you're returning a tuple, which happens to have natural syntax in the language. Defining Golang features that don't exist in Swift: - Interface types with implicit adoption (Swift takes explicit protocols from ObjC) - Error types - Relatedly, the "damnable use requirement" and its interaction wit…

> - Interface types with implicit adoption (Swift takes explicit protocols from ObjC)

Objective-C has informal protocols, and so does Swift.

Re: The Swift Programming Language

#433
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... .

> 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.

What Fortune 500 (or even 5000) systematically open sources every piece of technology? Every company I can think of -- Yahoo, Microsoft, Google, Facebook, LinkedIn, Twitter, Amazon, LinkedIn, AOL, Craigslist, Oracle, -- selectively decides what to open source.

I'm not saying that's right or wrong, but Apple is far from alone in doing so.

Re: The Swift Programming Language

#436
post #338

Earlier quoted context omitted.

It's probably a wise decision to have an "Algol patterned" language. No non Algol patterned language has ever become a mainstream programming language to my knowledge.

I am not a programming language wonk; so I imagine most languages I am familiar-with/know-of are necessarily Algol patterned. What are some non-Algol patterned languages?

In particular, Obj-C = Smalltalk + C. If you subtract C from Obj-C, you'd most easily just end up with Smalltalk. But that's not the right move for mass adoption.

Re: The Swift Programming Language

#437
post #308

For those without iBook, here's an excerpt from "The Swift Programming Language": http://pastebin.com/xsr401gt

It works in Calibre, provided you can get your hands on the epub file in some way...

I got it from Apple's ebook store. It showed up in ~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books

Re: The Swift Programming Language

#439

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.

I don't think this is very functional. First of all, the let binding inside the condition has type bool by itself (instead of the normal let-in construction). Also, it's scope permeates into the body of the if condition. The whole thing is very much like C-style NULL/Not-NULL check:

   if (x = proc()) {printf("%i", x);}

Re: The Swift Programming Language

#440

Earlier quoted context omitted.

It's fun once. It's impractical for someone editing the code later though, I don't want to have to look up the unicode character each time I want to remember it, and I don't want to have to copy and paste it either, it's better to stick with the characters available on a keyboard.

I have to agree. I had a love affair with unicode put directly in LaTeX markup (delta, integral signs, element-of, etc...) and it was very fun at first. Then I had to send the paper to a collaborator while writing a follow-up article together. I ended up removing all the unicode, and in subsequent work I didn't do it any more.

Why would you want to put math symbols in LaTeX using unicode? What would be the advantage over using a package like amsmath or even the native math environment? I'm genuinely curious.
Post reply on HN