Live data from Hacker News

The Swift Programming Language

developer.apple.com

491–500 of 970 posts

Re: The Swift Programming Language

#492
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…

From a user's point of view, it's basically straight out of the Rust book, all the gravy with also relaxed ownership and syntax.

It has it all [1]: static typing, type inference, explicit mutability, closures, pattern matching, optionals (with own syntax! also "any"), generics, interfaces, weak ownership, tuples, plus other nifty things like shorthand syntax, final and explicit override...

It screams "modern!", has all the latest circlejerk features. It even comes with a light-table/bret-victor style playground. But is still a practical language which looks approachable and straightforward.

Edit: [1]: well, almost. I don't think I've caught anything about generators, first-class concurrency and parallelism, or tail-call optimization, among others.

Re: The Swift Programming Language

#493
The documents for ios 8 show all examples in objective-c. Can't wait for them to be updated to swift. I'd love to start with 'getting started' and work my way through rest of the docs. I'm a programmer but could never stomach objective-c.

Re: The Swift Programming Language

#494
post #358

Earlier quoted context omitted.

> So if Apple's goal was to get new devs into the iOS world, at least > from 10k feet, it's working They just announced Swift, at a conference for Apple developers, with live streaming that is only easily accessed from an ios device. I think it is probably premature to pop the corks and celebrate the efficacy of the get new developers initiative.

Well; based on the promise of immediate inclusion in the app store and a very well thought out book about the language available for free I'd say they're doing rather well so far already.

You mentioned things that are likely to bring about the desired result of creating new ios developers. I am not disagreeing about the likelihood of success. I am simply saying that T + 8h is probably too soon to conclude that the program is successfully creating new ios developers. To be honest I think it is absurd to expect that such a program from any company could bring about the desired goal of creating new developers in less than eight hours.

Re: The Swift Programming Language

#495
post #472

I found the notion of "Optionals" surprising and a bit hard to handle at first. In Objective C it was really easy to lazily allow values to be nil and still do things on them, so it's a bit of a departure. Thinking about it a bit longer, is it because of the clear distinction between non nullable values ans optionals that the compiler can optimise the code so much more ? (I am thinking about the xx times faster than…

This might increase performance, but I'm pretty sure it's mostly there for safety. It forces the programmer to check for nil. It's like Haskell's "maybe" type.

Re: The Swift Programming Language

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

PDF - https://www.dropbox.com/s/wkxqv1zcgrg28m4/The%20Swift%20Prog...

Re: The Swift Programming Language

#497
post #52

"...we wondered what we could do without the baggage of C." Is that tongue in cheek? It's not even a particularly large, encumbered language, C.

Heartbleed. Majority of all SSL keys on the internet compromised. All ~2 billion of humans on the internet required to change their passwords due to a single mistake by a single programmer using C. That's billions of human beings wasting hours either changing all their passwords or having their money, identities, medical records, and more stolen because they didn't. Having their accounts hijacked. For all we know tot…

It is unethical to continue writing code in non-memory-safe C or C-based languages, for any purpose. Period.

I'm looking forward to seeing your new operating system and managed runtime written entirely using garbage-collected languages!

Re: The Swift Programming Language

#498

Earlier quoted context omitted.

It's not hate, but Objective-C can be intimidating.

I just spent the past 2 months learning obj-c, about to release my first app and boom, X out obj-c. my luck.

No worries, Objective-C is faaar from deprecated.

Re: The Swift Programming Language

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

Marketing are claiming a 91.3x.

Re: The Swift Programming Language

#500
post #472

I found the notion of "Optionals" surprising and a bit hard to handle at first. In Objective C it was really easy to lazily allow values to be nil and still do things on them, so it's a bit of a departure. Thinking about it a bit longer, is it because of the clear distinction between non nullable values ans optionals that the compiler can optimise the code so much more ? (I am thinking about the xx times faster than…

It's because it has a grown-up type system. This is a great step in the right direction. ObjC's treatment of nil was handy for a long time, but a basic Option type is far better to show the intent of code.
Post reply on HN