Well we've been playing with Swift for over a week now, and had a chance to actually write some code and start to form an option (I don't think it's fair to say anything more than that at the moment, everything is beta - including the syntax). I'm not going to talk about Playground crashes or exploding project templates, if they are there in the GM, well that's the time to write a review.
Here are our thoughts
- Adding semi-colons like an animal: After four working days playing, and one actually trying to build something (more later), we had to pop back to Objective C to do some product maintenance. What was clear is that what initially felt like somewhat enforced brevity at the end of the week feels like elegance. Let's not even mention square brackets.
- Surprisingly expressive: Optionals, generics, on top of some old friends from Objective C stack up into a language that very clearly (see above) captures intent. In our day of proper coding we were left feeling that we were very clearly able to communicate to our future selves what we were thinking at the time.
- Optionals, not optional: These have turned out to be a real win in our opinion. Initially it felt heavy weight; we could check if things were nil ourselves thanks. In the end I think that's still true, but there are two import aspects that optionals bring. The first is about expressing intent (see above), I can tell you very clearly... you might not get a valid value. The second, and for me at least most interesting, aspect is that the ! forced unwrapping is actually a short-hand for an explicit assertion that something is not nil. That's a good assertion to have in your code from day zero. If a crash is not acceptable, you know you need to use "if let". Finally... and I don't know where else to mention this... if this is a language that is intended to be easy to learn... why nil (or null for that matter)? I would have preferred NotSet or perhaps even Nothing.
- Swift is a vampire: The absence of any reflection APIs really hurts, we often do "clever" things were classes are created based on configuration files and other "non-code" sources. I do wonder if the absence is actually an indication of things to come. Is reflection very Swift-y? I don't think so. I am beginning to think that in a future revision we may get meta-data syntax which we can use to provide ORM mappings and the like, but that actual reflection may never come. I think that may even be good (after all, isn't reflection just a way of getting at meta-data?). I still see a problem if we can't conjure a class out of thin air (OK, a string, but you know), especially considering we could downcast it and constrain the unknowability to small piece of code.
- Mapping the Bridges: The Cocoa/Foundation bridges feel very un-Swift like. I've become used to letting my constructor define the type of objects (meaning I only have to be explicit once), but to have a the type change just because I put import Foundation at the top of the file? No no no. I think we need explicit mappings. It's more work, but this is an area that keeps catching us, especially as code moves from a quick playground to an actual Swift file in a project.
- Playgrounds: Superb. Yes they are prone to exploding at the moment, but it's a beta guys, and the first beta build at that. However, quickly testing ideas out? Priceless.
All in all, we are very impressed, as solid a start as you could imagine. How about you? What aspects of Swift have you loved or hated in the first week?