Live data from Hacker News

Swift 1.2 and Xcode 6.3 beta

developer.apple.com

1–10 of 94 posts

Re: Swift 1.2 and Xcode 6.3 beta

#2
Coming to Swift as a Scala developer I really enjoy using the language. While it lacks the functional completeness of other functional languages I like writing it, it's specific set of features is very handy and easy to pick up. I think Apple did a great job building a pragmatic language that gives people good constructs and lets them get their jobs done rather quickly. I'm looking forward to Swift on Xcode stabilize and mature.

Re: Swift 1.2 and Xcode 6.3 beta

#4
post #3

This is practical. It's something you wish for within a couple hours of Swift. let x : SomeThing if condition { x = foo() } else { x = bar() } use(x)

short of having a language mechanism for doing an 'uninitialized' let, conditional operators could work:

let x : Something = condition ? foo() : bar()

but yeah, it would be nice to defer initialization of an immutable.

Re: Swift 1.2 and Xcode 6.3 beta

#5
post #4
post #3

This is practical. It's something you wish for within a couple hours of Swift. let x : SomeThing if condition { x = foo() } else { x = bar() } use(x)

short of having a language mechanism for doing an 'uninitialized' let, conditional operators could work: let x : Something = condition ? foo() : bar() but yeah, it would be nice to defer initialization of an immutable.

Let's hope you don't have a baz.

Re: Swift 1.2 and Xcode 6.3 beta

#6
post #4
post #3

This is practical. It's something you wish for within a couple hours of Swift. let x : SomeThing if condition { x = foo() } else { x = bar() } use(x)

short of having a language mechanism for doing an 'uninitialized' let, conditional operators could work: let x : Something = condition ? foo() : bar() but yeah, it would be nice to defer initialization of an immutable.

often times you want to do more stuff in either case so ? does not always work. The if-else approach is more general.

Re: Swift 1.2 and Xcode 6.3 beta

#7
post #4
post #3

This is practical. It's something you wish for within a couple hours of Swift. let x : SomeThing if condition { x = foo() } else { x = bar() } use(x)

short of having a language mechanism for doing an 'uninitialized' let, conditional operators could work: let x : Something = condition ? foo() : bar() but yeah, it would be nice to defer initialization of an immutable.

Note that it's no longer "would," this is a feature included in this beta. OP's code is now legal.
Post reply on HN