Live data from Hacker News

The Swift Programming Language

developer.apple.com

441–450 of 970 posts

Re: The Swift Programming Language

#441
post #37

I'm not even an iOS developer but this is by far the most exciting thing I heard in the keynote. As an amatuer/hobbyist programmer who's self-taught with Ruby, JavaScript, etc., the one thing that was keeping me from experimenting with iOS apps was Objective-C. I know I could tackle it, but it's been hard to take the plunge. I don't know much about Swift yet, but from what I've seen it looks very exciting. So if Appl…

I don't get the hate. Yeah, syntax is unfamiliar, bu once I got used to it I began to really enjoy objective-c. Ymmv etc., but it's now one of my fav languages - though I guess this is mostly due to cocoa

I don't think syntax is really the issue. Using objc these days is clunky for reasons besides syntax.

Re: The Swift Programming Language

#443
post #83

“You also don’t need to write semicolons at the end of every statement.” Please. Please. PLEASE don't be whitespace delimited!

Ruby doesn't have neither semicolons nor whitespace syntax

Ruby has both semicolon and newline statement termination.

    > x = 1; y = 2; z = x + y
     => 3

Re: The Swift Programming Language

#444
post #432

Earlier quoted context omitted.

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.

[deleted]

Re: The Swift Programming Language

#446
post #256

Earlier quoted context omitted.

You can do this in C# (and presumably other languages). I've seen people using Greek symbols in mathy code before. It's kind of fun.

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 guess it depends what country you're currently in. I know some chinese developers would prefer some chinese characters because it happens to be the ones available on their keyboard.

Re: The Swift Programming Language

#447
post #428

Earlier quoted context omitted.

You can actually read the language reference with a "standard browser": https://developer.apple.com/library/prerelease/ios/documenta...

Hmm, can't seem to change page in Chrome. In Firefox, it works slightly better but still doesn't really. I'm guessing it only works on Safari? How can they release a language and not have proper documentation that is accessible by anyone? It'd be great if someone could get the book, convert it to PDF and post it online.

I can switch pages in both Chrome and Firefox.

ePub[1] has been posted elsewhere in this comment thread.

[1] https://news.ycombinator.com/item?id=7835994 (accidentally said PDF instead of epub before)

Re: The Swift Programming Language

#448

I just skimmed the tour, and my impression is: Swift is a compiled, Objective-C compatible Javascript-alike with an ObjC-like object model, generics, and string interpolation. No exceptions. Based on LLVM and appears to inherit the same data structures as Cocoa apps (Dictionaries, Arrays, &c). It feels very lightweight, sort of like an analog to what Javascript is in a browser.

JS has exceptions though. I didn't notice that bit until just now… hmm. Could turn into lots of return-checking boilerplate. I'm still excited about this, very much so, but I think exceptions are worth keeping.

Re: The Swift Programming Language

#449
post #355
post #289

"The company says that Swift apps are significantly faster than Objective-C apps, outperforming them by over 93x." With a graph showing ObjC at 127x faster than Python, Swift 220x faster than Python. Thus the conclusion is 220 - 127, Swift is 93x faster than ObjC. Someone needs to resit their GCSEs.

"93x faster" sounds roughly like a 46.5x improvement in marketing.

It's not only possible, it's even not uncommon for a C programmer to get a 90X improvement in speed in their own C program. If you have naive memory management, or incorrectly implemented concurrency or parallelism, you can easily lose 2 orders of magnitude speed.

Re: The Swift Programming Language

#450
post #37

I'm not even an iOS developer but this is by far the most exciting thing I heard in the keynote. As an amatuer/hobbyist programmer who's self-taught with Ruby, JavaScript, etc., the one thing that was keeping me from experimenting with iOS apps was Objective-C. I know I could tackle it, but it's been hard to take the plunge. I don't know much about Swift yet, but from what I've seen it looks very exciting. So if Appl…

I'm not really that impressed--it looks like a hodgepodge of ideas from ES6, Ruby, Go, and maybe Rust, with a bit of backend work done to let it work on their existing infrastructure. I dislike that Apple has continued the special snowflake approach, that for some reason we as developers need to learn yet another different-but-almost-the-same language to develop for them, instead of just adding proper support and doc…

Agreed that the lack of using an existing (and open-source!) language is annoying and frustrating to deal with (think of where we'd be if they invested that time and effort into improving Ruby/Python/whatever instead!). But because of the desire for compatibility with Objective-C, and Apple's general desire to call all the shots regarding their ecosystem, this move doesn't surprise me in the least.
Post reply on HN