Live data from Hacker News

Swift 1.2 and Xcode 6.3 beta

developer.apple.com

81–90 of 94 posts

Re: Swift 1.2 and Xcode 6.3 beta

#81
post #45

Earlier quoted context omitted.

That doesn't seem to be the case. I just made a free account quick to test this, and it won't let me access the betas without being a member of the paid iOS developer program.

I just downloaded 6.3 beta using my free account.

By navigating from the developer center, or using a direct link you found elsewhere? I was able to download the release notes with a direct link but I couldn't actually find the link anywhere from Apple.

Re: Swift 1.2 and Xcode 6.3 beta

#82
post #79

Earlier quoted context omitted.

I'm not a language guy so I don't know anything about generalized pattern matching. Maybe it is better. But for my own use, "if let" ensures that I always take care of any possible nulls in my code, while also keeping the conditional code in the same scope as the verified variable. There's no easy way to leave pointers dangling or uninitialized. The language design forces me to organize and think about my code in a m…

With generalized pattern matching, your code could (among other things) take the form of case result of Just x -> Nothing -> This works with optionals as well as any other algebraic data type.

I'm not sure if this is the case in your example, but at least in Swift, the "if let" block or chaining for optionals is mandatory. This should mean that it's impossible to have a dangling/null pointer unless you use the force dereference operator. (And that's something that should almost never appear in your code!) You don't get the choice of being lazy or forgetting about checking your pointers: it's a conscious decision either way.

Personally, I appreciate that the language naturally makes me organize my code better and more safely.

Re: Swift 1.2 and Xcode 6.3 beta

#83
The type inferrence fix ("Type inference for single-expression closures has been improved in several ways:") is the most annoying one for me. Glad they've fixed it. Sure, compiling faster and having less crashes is nice. But that means nothing if it isn't compiling _correctly_.

Re: Swift 1.2 and Xcode 6.3 beta

#84
post #69
post #59

Earlier quoted context omitted.

There is always hope I guess. Swift library is Cocoa and even if they eventually open Swift, it is going to be as useful as Objective-C is outside Mac OS X and iOS. Personally I don't care. What I care is about tools that make my customers happy.

Swift has its own standard library, Foundation for things that fall outside the purview of the native stdlib (e.g. JSON parsing and regular expressions), and ApplicationKit/UIKit for GUI stuff. A multiplatform Swift + stdlib would already be quite useful for non-GUI applications on other platforms.

There are already lots of ML based languages to choose from with more use in the market than Swift.

A Swift compiler without the Mac library will be a very poor choice in regards to any existing ML language.

Re: Swift 1.2 and Xcode 6.3 beta

#85
post #84
post #69

Earlier quoted context omitted.

Swift has its own standard library, Foundation for things that fall outside the purview of the native stdlib (e.g. JSON parsing and regular expressions), and ApplicationKit/UIKit for GUI stuff. A multiplatform Swift + stdlib would already be quite useful for non-GUI applications on other platforms.

There are already lots of ML based languages to choose from with more use in the market than Swift. A Swift compiler without the Mac library will be a very poor choice in regards to any existing ML language.

Potential users can decide whether or not it's a poor choice themselves. I suspect the language would be more popular than a strict reading of its merits might suggest.

Re: Swift 1.2 and Xcode 6.3 beta

#86
post #79

Earlier quoted context omitted.

With generalized pattern matching, your code could (among other things) take the form of case result of Just x -> Nothing -> This works with optionals as well as any other algebraic data type.

I'm not sure if this is the case in your example, but at least in Swift, the "if let" block or chaining for optionals is mandatory. This should mean that it's impossible to have a dangling/null pointer unless you use the force dereference operator. (And that's something that should almost never appear in your code!) You don't get the choice of being lazy or forgetting about checking your pointers: it's a conscious de…

It is, and you can pattern-match Optional in Swift, something along the lines of

    switch optional {
    case .Some(let numeral):
        println("Caught a \(numeral)")
    default:
        println("Nothing to catch")
    }

Re: Swift 1.2 and Xcode 6.3 beta

#87
post #73

Earlier quoted context omitted.

If let (and optionals in general) is my favorite Swift feature and has immediately made my code 10x more stable from the get-go. Glad to see it get expanded like this.

Why is "if let" preferable to generalized pattern matching?

It's not "preferable" in the sense that you should have if let and not pattern matching. In Rust (and probably in Swift) it builds upon (and maybe desugars to, not sure) pattern matching. `if let` tends to be shorter and more readable than a full-blown match with a single match branch or just match/fail. Chainable `if let` is also significantly more convenient when trying multiple alternatives (on different source variables) one after the other.

See the Rust RFC on the subject for motivations and comparisons: https://github.com/rust-lang/rfcs/blob/master/text/0160-if-l...

Re: Swift 1.2 and Xcode 6.3 beta

#88
post #33

> Source files that haven’t changed will no longer be re-compiled by default That's a nice example of "if you're not embarrassed of 1.0, you shipped too late".

If this is actually going to work well - great news for bigger swift projects.

The compile time caused by this issue was making the development process really slow. We had to split the whole application into mini sub projects to make it bearable.

Re: Swift 1.2 and Xcode 6.3 beta

#89
post #81

Earlier quoted context omitted.

I just downloaded 6.3 beta using my free account.

By navigating from the developer center, or using a direct link you found elsewhere? I was able to download the release notes with a direct link but I couldn't actually find the link anywhere from Apple.

I was able to download it from the developer center.
Post reply on HN