He seems to generally like it -- similar to Rust in a lot of ways, but a little higher-level, which is appropriate for its intended uses (iOS and OS X apps). He nor I seem to think that it can replace Rust (especially if they don't open it up!), but it definitely seems like a compelling option. EDIT: Does anyone know if it's possible to try it without a paid iOS / OS X dev license? I'd especially like to try the play…
I don't know that there is much question of replacing Rust when it isn't in use except as an unstable experiment with a lot of interest. You could replace Rust with outright vaporware.
Swift – observations from Rust’s original designer
51–60 of 88 posts
Re: Swift – observations from Rust’s original designer
#52Earlier quoted context omitted.
They haven't publicly released it yet. Xcode 6 which includes Swift is currently part of the beta available as part of the Apple Developer Program. That means it is still under NDA as well. Most likely after Xcode 6 is released publicly (i.e. available on the Mac App Store) they will do a code dump back to the LLVM project.
> That means it is still under NDA as well. Partially. They made the language manual freely available on the iBookstore.
Re: Swift – observations from Rust’s original designer
#53He doesn't seem to know much about iOS or Objective-C due to that comment about parameter names probably being unused. You wouldn't be able to make meaningful method selectors calling into the code from Objective-C without them, since the names of the parameters are part of the method name in Objective-C.
Method parameter names are used similarly in Swift as in ObjC. For example two methods can have the same name, as long as they have a difference set of parameters. For example: func methodName(paramName: String) and func methodName(paramName: String, otherParam: Int) are different. I'm still playing with this but there are some interesting/weird things in here. What follows is a bunch of random observations of how na…
Did you miss the part about default values?
If you're calling an Objective-C selector with more than one argument, you are indeed using an external parameter name, but external parameters are explicitly not required if you're writing pure Swift.
https://developer.apple.com/library/prerelease/ios/documenta...
Re: Swift – observations from Rust’s original designer
#54Earlier quoted context omitted.
How much cleaning up do you expect at this point? It's already both announced and released to developers. Obviously it's not 100% finished, but if they intended to open-source it, I wouldn't expect that announcement to come after publicly releasing it.
They did announce they would not guarantee source compatibility until after the release date. So the language will likely change a bit still.
Re: Swift – observations from Rust’s original designer
#55I think the author is seeing a little more than there actually is. There is a lot more overlap between Swift and C#/Java than with Rust. Actually, I see very little Rust in Swift, except for very trivial features that are present in 90% of C-based languages. But hey, any opportunity to pimp your favorite language is fair.
Re: Swift – observations from Rust’s original designer
#56Re: Swift – observations from Rust’s original designer
#57I think the author is seeing a little more than there actually is. There is a lot more overlap between Swift and C#/Java than with Rust. Actually, I see very little Rust in Swift, except for very trivial features that are present in 90% of C-based languages. But hey, any opportunity to pimp your favorite language is fair.
It is common when a new language appears to authors to see similarity with their own language. Actually, most of the features of Swift were already implemented in some older language. Extended pattern matching for example exists in Scala.
Re: Swift – observations from Rust’s original designer
#58I hope ideas will flow the other way too, and Rust adopts some sugar from Swift. I find `if let concrete = optional` sooo much nicer than `match optional { (concrete) => , _ => {} }`. Rust has solid semantics that covers more than Swift. OTOH Apple has put their UX magic into the language's syntax. Some syntax shortcuts, like `.ShortEnumWhenInContext` are delightful. The two combined will be the perfect language ;)
macro_rules! if_let {
($p:pat = $init:expr in $e:expr) => {
{ match $init { $p => $e,_ => {}, } }
}
}
fn main() {
let tup = (2, 3);
if_let!{(2, x) = tup in println!("x={}", x)}; // prints x=3
if_let!{(5, x) = tup in println!("x={}", x)}; // doesn't print
}
It's slightly more heavyweight, but still not too bad.Re: Swift – observations from Rust’s original designer
#59Earlier quoted context omitted.
I wouldn't be surprised if Apple ends up open sourcing Swift after it cleans it up, perhaps even making it an LLVM project. I see it similarly to how they handled their own AArch64 backend -- proprietary at first, but mostly for secrecy before it was announced and then merging it with the preexisting backend after it was announced.
How much cleaning up do you expect at this point? It's already both announced and released to developers. Obviously it's not 100% finished, but if they intended to open-source it, I wouldn't expect that announcement to come after publicly releasing it.
And when iOS 8 and OS X Yosemite are released this fall, you can submit apps that use Swift to the App Store and Mac App Store.
This is intended as a beta, and they won't even allow you to use it in production yet, even if you wanted to, so you can expect some small changes to the language spec as they refine it. Typically the xcode betas can't be used to submit, and Apple have released other projects closed source before open sourcing them (for example webkit).
It's interesting that they're moving development on both platforms to this new language. I wonder when we'll see a unified API?
Re: Swift – observations from Rust’s original designer
#60PS: Apple says "Swift is an innovative new programming language"! Just like everything else they do lately!