5 ms·
Swift WTF
- valevk 12y ago"There are only two kinds of languages: the ones people complain about and the ones nobody uses."
- s_kilk 12y agoSwift may in fact be the exception to that rule, as everyone complains about it and almost no-one uses it ;)
- itg 12y agoIf the ones complaining don't even use it, it says much more about those people. ;)
- pnathan 12y agoThat is a terrible quote, provided by an author trying to defend a fairly awful language. It is rhetorically weaselly, attempting to cast aspersions at critics, without actually providing meaningful defenses.
- zak_mc_kracken 12y agoIt's humor. Chill out.
- guru_meditation 12y agoThe examples look really scary. So far I understood Swift to be the next big thing in terms of hot programming languages with a functional flavor. Those more proficient with Swift, are posted screenshots manifestations of bugs or are we seeing correct output? Hoping these are bugs that have been fixed in the meantime.. otherwise this reminds me of Javascript type promotion..
- sho_hn 12y ago> So far I understood Swift to be the next big thing in terms of hot programming languages with a functional flavor. Swift is tightly coupled to Apple's platforms (which are of course commercially very viable, and if you develop for them you should be looking at Swift), under a proprietary license and developed under closed governance. It's a legitimate product, but under those circumstances it doesn't really have a shot at being a NBT in programming by itself, beyond contributing its ideas to wider discourse. It's obvious that no generally relevant library/infrastructure will be written in Swift, for example; if anyone with a great idea choses to implement it in Swift first for whatever reason, it will be a reimplementation in another, more widely useful language that gains widespread popularity.
- i_s 12y agoAre all the issues with Swift to be expected, or does it seem like there are more issues with Swift than one would normally expect normal from a new programming language?
- empthought 12y ago"Xcode 6 beta 3." AKA some software that was never released generally, from July 2014.
- faitswulff 12y agoI thought that was curious, so I put one of their code samples to the test: Swift WTF: http://swiftwtf.tumblr.com/image/88465530183 http://swiftwtf.tumblr.com/image/88465530183) But it looks fine on my machine (Xcode 6.2): http://imgur.com/rJU7lcx http://imgur.com/rJU7lcx
- mikeash 12y agoYeah, this is silly to talk about now. I'm sure you can dig up plenty of WTF things about the latest Swift, but few if any of these examples are still valid.
- austinz 12y agoThis is a blog whose latest entries deal with Xcode 6.0 beta 3 (out of at least 7 eventual betas, many of which made substantial changes to the language). Right now, the 'standard' Swift version is Xcode 6.1's (Swift 1.1), and Swift 1.2 is in its third beta. So it's definitely not representative of the current state of the language (which was, admittedly, in pretty awful shape at that point in time).
- drinchev 12y agoIMHO those bad examples are more or less bad, because of the high expectations and reputation of the company that released the language. Having in mind the age of Swift this site would not be so surprising if behind it there was a smaller team. It would be really better if Apple go back in time and release working products in their first version. I understand having so big user (developer) base is hard, but as far as what we see from the financial reports they can easily afford having better software, by improving some development processes.
- oldmanjay 12y agoyou classify a problem you don't even fully understand as easily solved because you're willing to spend other people's money freely. you have upper management written all over you.
- drinchev 12y agoGreat reply, although I was hoping to make a discussion out of this. Negative sentences doesn't contain as much information as positive ones. "I don't like what you like" carries less information than "I like [something different]". In other words. If you tell me what your opinion is I might change mine too.
- beltex 12y ago“Most perplexing feedback on Swift: folks who see it (and judge it) as the end of a trek - but don't realize it is the start of a new world.” Chris Lattner https://twitter.com/clattner_llvm/status/474082459860992000 https://twitter.com/clattner_llvm/status/474082459860992000
- gleenn 12y agoThe equality and truthiness oddities are the worst. One of my biggest pet peeves about languages is weird equality rules. PHP is one of the worst, there is a huge table of crazy rules that I suppose expert PHP people can remember, but it just seems crazy. Languages like Ruby and Clojure have it best: nil and false are falsy, everything else is truthy.
- mikeash 12y agoSwift's rules are pretty simple too: true is true, false is false, and nothing else is any sort of boolean. If you want to check whether an array is empty, do so explicitly. If you want to test an integer for zero, you have to do == 0. Even testing for nil requires an explicit != nil. As for equality, I think it's just old bugs from an old prerelease compiler. These posts are ancient history, relatively speaking. I just tested on the latest public release and a == [1], [1] == a, and [1] == [1] all produced true, as one would expect. str === str won't compile, also as one would expect (String is a value type, and as such comparing object identity is nonsensical).
- AnkhMorporkian 12y agoPHP is pretty bad, but I think JS really takes the crown for insane equality comparisons. Basically every weird equality comparison from PHP is in JS, along with some other humdingers like 0 == []. And my favorite, '\n\r\t' == 0
- quarterto 12y agoThere is never a good reason to use ==.
- AnkhMorporkian 12y agoI totally agree, but they were bringing up the insane equality rules in PHP using the == operator, so I did likewise in Javascript. Both languages luckily have fantastically logical === operators.
- woah 12y agoLearning iOS dev, coming from a js background, I have very few complaints about swift. It is in fact a very nice language. The biggest pain is apple's frameworks and ide. The APIs are very inelegant and arbitrary. The worst thing is the drag and drop interface builder. I believe that the people who designed it never actually built an iPhone app with it. You can always get about 80% of what you want, then you have to resort to some outrageous hack and stitch the rest of it together with verbose imperative code. Declarative web dev with html really is a huge step up from Apple's stupid drag and drop thing. Hopefully Swift is the start of Apple putting together a sane, modern development environment.
- edwinnathaniel 12y agoI've never done any iOS development due to job market (mostly contracts/consulting, not my kind of thing at the moment) and due to Apple track record on Development Environment (Drag-n-Drop, meh-IDE, etc) but I have to wonder, Microsoft, GWT (when it was still backed by Google), Android UI, Qt do support (or move toward the direction of) declarative UI model type of development. Only Apple that does not (right now I guess), what gives? Most platforms that come out these days usually have support for: 1) dependency management 2) some sort of way to make build from command line (CI integration) 3) unit-testing framework and runner 4) SCM strategy that unifies unit-test/integration-test runner, build the thing, package it to the point of ready to ship... How are these handle in the world of iOS which is backed by a multi-billion dollars company?
- JimDabell 12y ago> Microsoft, GWT (when it was still backed by Google), Android UI, Qt do support (or move toward the direction of) declarative UI model type of development. Only Apple that does not (right now I guess), what gives? What does you mean by "declarative UI model"? You have been able to define UI declaratively using Interface Builder since day one. Do you mean something more than this? > dependency management CocoaPods or Carthage. > some sort of way to make build from command line (CI integration) xcodebuild. > unit-testing framework and runner XCTest. > SCM strategy that unifies unit-test/integration-test runner, build the thing, package it to the point of ready to ship.. Can you give an example? Xcode Server does at least some of this. I don't think this is something commonly provided as a standard part of most platforms.
- zak_mc_kracken 12y agoI predict this blog will run out of content real fast. I also notice the author conveniently left out the timestamps for their posts. Swift is still very new, crashes in the language and in the IDE will not surprise anyone who calls himself a software engineer. I don't write code on iOS or MacOS but Swift looks very solid to me and an obvious improvement over Objective C.
- andrewstuart2 12y agoIt kinda seems like it already has run out of content. Most of the examples are using either a beta version of Xcode or version 6.0, at least 2 minor versions behind. As a few people have pointed out, some of the examples aren't even reproducible on the current versions.
- mikeash 12y agoThe last post is from July of last year, only a month after the language got its first public reveal.
- le_lenny_face 12y ago>Swift is still very new, crashes in the language and in the IDE will not surprise anyone who calls himself a software engineer. And yet Rust is reliable as fuck even in its current shape. Swift has no excuse to be so unpredictable, especially given that it's back by a humongous commercial company.
- melling 12y agoRust hasn't even gone 1.0 and they're doing nightly releases. Just from that, I'd say that it's not ready for production so it hasn't reached "reliable as fuck". People are shipping production Swift. And as people have already mentioned, these examples were from last year, and many issues have already been fixed. Anyway, I know it feels good to throw stones but it really adds no value to the conversation.
- pcwalton 12y ago
- MCRed 12y agoThis blog is from when the language was first announced, yet most people commenting seem to think it is current, and thus imply that SWIFT is in worse shape than it is. Flagged.