2 ms·
Would the problems outlined there be any better in Clojure? Type inference: at least in Swift you have types; the author dismisses "click on it in XCode", but
by lmm 12y ago
Would the problems outlined there be any better in Clojure?
Type inference: at least in Swift you have types; the author dismisses "click on it in XCode", but that's still better than you get with Clojure.
nils in the Objective C bridging APIs - you're going to have to solve that somehow, even in Clojure. I don't know how Clojure invokes Java code, but you have two choices, neither of them good: either you treat every "FFI" call as returning Option, in which case all your code that calls libraries is littered with Options and you better have a syntax for easily "casting" out of Option (like the one the article complains about), or you allow nils to cross the divide into your nice language and anything that calls the "FFI" has to worry about them.
I don't have a lot of Swift experience, but it looks like a decent incremental improvement, applying some of the lessons of modern language design in a conservative Algol-style syntax that many programmers are happy to use. (I'd've been happier to see Scala support, but I can see why Apple would want their own language). Clojure isn't that (and from Apple's PoV, anyone dedicated enough to use Clojure is probably also dedicated enough to use a non-first-party language).
- adrusi 12y agoRemember that clojure is dynamically typed. `nil` is its own type, but in a dynamically typed language, it can still be used anywhere. I have a slight preference for statically typed languages, but FWIW I find I make a lot fewer type errors in Clojure (and other lisps) than in, say, Javascript. And for users who can't stand dynamic typing, there's core.typed I don't think Clojure would have been a sane choice for Apple though. It's too memory hungry for mobile and developers would avoid it because of how different it is from objective c