6 ms·
On paper, Swift is my perfect language. It's like a slightly higher level rust. For a while I was enamored of Haskell and its famed "if it compiles it works" s
by losvedir 7y ago
On paper, Swift is my perfect language. It's like a slightly higher level rust.
For a while I was enamored of Haskell and its famed "if it compiles it works" saying, but I think I've realized that the features that contribute to that are: non-nullability and algebraic data types. Turns out I don't particularly like the extreme functional nature or (especially) the lazy aspect of it.
Rust is almost there, but then I'm dealing with lifetimes and working a little lower than I usually need. But I found I _love_ its exhaustiveness checking for enum variants.
The ML family is pretty much in my sweet spot, for some reason it doesn't really get the love that it seems it deserves, and last I heard Ocaml had an issue with being single threaded.
So that leaves Swift, with its non-nullability, algebraic data types, and exhaustive enum pattern matching. The only downside is its focus on Macs! I'm holding my breath, waiting for it to run just as smoothly on linux, and developing some developer cultural cachet and libraries for servers. I hope it does! I'm glad to see in this article that it's being used more and more at Apple.
And with SwiftUI, which looks pretty promising, I have to imagine it will only continue to grow in popularity.
- novok 7y agoThe funny thing is, those are not expensive or difficult things to implement in a compiler.
- mruts 7y agoHow about Scala?
- rad_gruchalski 7y agoIt’s a really nice language. I like it a lot. But it has a dependency on a pretty hefty runtime. I understand that packaging nowadays is not really a problem, but still.
- mruts 7y agoYou should check out GraalVM. Easy compilation to native code. A total game changer for the JVM, imo.
- bluejekyll 7y ago> Rust is almost there, but then I'm dealing with lifetimes and working a little lower than I usually need. But I found I _love_ its exhaustiveness checking for enum variants. Out of curiosity, when's the last time you worked with Rust? A lot of the lifetime's have been able to be elided in recent releases, especially in the 2018 edition. That's not to say that you don't still run into them, but in the middle of the road cases, it's much less frequent that you run into them unexpectedly.
- conradev 7y agoHaving written a lottt of both Rust and Swift there is something about Swift that makes it "flow" far easier than Rust. I haven't been able to narrow down exactly what it is, but with Swift I can just put pencil to paper. With Rust I feel like I need to plan more, I dunno. I do think my experience is colored by tooling, though
- choxi 7y agoSwift feels like a Frankenstein language though, there are so many keywords and new ones get added in every update. This article here [1] stack ranked a few languages by number of keywords and Swift is #4 on the list. And in Swift 2.1 they added some more, like properties wrappers and the `some` keyword. It gets hard to keep track of them all and the special behavior each one implies. On the other hand, you can kind of make your own language within Swift because most of the keywords aren't required but allow some additive features. For example, some features help you write your code functionally and others support a declaritive style. It reminds me of what's going on with Babel and JavaScript, where babel extensions are like these language plugins you can mix and match to create your own language. If you think of metaprogramming as a way to build your own language within a language, lisps and Ruby were kind of like pioneers of a build-your-own-language trend. I could see that as an interesting direction, I wonder if people have tried it before. [1] https://medium.com/the-traveled-ios-developers-guide/swift-keywords-v-3-0-1-f59783bf26c https://medium.com/the-traveled-ios-developers-guide/swift-k...
- anoncareer0212 7y agonit, only mentioning it because I'm super curious about that list: searching for "4" and "rank" in the article doesn't show any relevant results to the ranking
- choxi 7y agoah sorry I pasted the wrong link, here it is: https://medium.com/@richardeng/how-to-measure-programming-language-complexity-afe4f7e75786 https://medium.com/@richardeng/how-to-measure-programming-la...
- throw_away 7y agoMore accurately, it's tied for third place with C++.
- m_mueller 7y agooh wow, smalltalk has only 6 keywords. that's really... small :).
- groovebits 7y agoThere is also F#, open source and available in .net core on multiple platforms
- fortran77 7y agoI love F#, and the whole .net environment. It's very performant, (and C# isn't a bad language either for you OO fans). GC is ok by me.
- TurboHaskal 7y agoFunny, the reason why I ended up not exploring Swift further, and instead trying out F#, was due to Swift's lack of tracing GC.
- yawaramin 7y ago> last I heard Ocaml had an issue with being single threaded. OCaml is single-threaded, yes, but in practice that's not a big deal. There's a great concurrency library (Lwt) and the recently-added monadic (and applicative) bind syntax makes it look almost like sequential code. And if you really need a separate OS thread, there are ways to do that :-) Last I checked, Swift still does concurrency mostly with Node-style callbacks.
- sizeofchar 7y agoSwift is my dream programming language as well, but I tried (2 years ago) reimplementing some python scripts in it and I had a hard time with things as simple as printing to the terminal (which involved distinct libraries and methods for mac and linux), and other things I don't remember very well at the moment. But I do remember having to implement myself protocols for standard library types, most of them obviously belonged to the standard libraries, they even had theses protocols as examples in Apple's docs. The language is truly great, but was not ready for primetime out of Cocoa apps. Has anything changed?
- SkyPuncher 7y agoI briefly built a Swift app. I hated Xcode, but Swift was by far my favorite language I have ever worked with. I'd love to see a Rails like framework come to Swift. I don't think we'll ever see that.
- aplummer 7y agoThere is one at least! www.vapor.codes, it’s really great.
- walkingolof 7y agoIf you like the Swift language, you would also like Scala, and Scala has Play, which is Rails like. Also, in anticipation of that question, yes, Scala can be AOT compiled using Graal. https://leverich.github.io/swiftislikescala/ https://leverich.github.io/swiftislikescala/
- greggman2 7y agoAnd that unlike Rust Swift is often much slower if you aren't extremely careful how you use it
- skohan 7y agoSwift has a different niche than Rust. They both offer safety, but Rust prioritizes performance, where Swift prioritized ergonomics. For me personally, Swift is often fast enough for my needs as a compiled language, but it's so much easier to be productive in since it obviates many of the more tedious concerns of Rust. Both languages play nicely with the C FFI so it's also possible to write high-level code in Swift and drop down into C or Rust for the performance sensitive parts.
- AceJohnny2 7y ago> I'm holding my breath, waiting for it to run just as smoothly on linux, and developing some developer cultural cachet and libraries for servers. Apple Swift developers are actively working Linux support, but I suppose it'll forever remain a second-tier platform to iOS & macOS. Kind of like C# to Windows, but Swift doesn't have its Miguel de Icaza to create its Mono on Linux. I'm sure the Swift team is well aware of this cultural bottleneck, hence the current efforts to support Linux, but it remains a cultural chicken-and-egg problem.
- favorited 7y agoIt's not just Apple working on Swift on Linux. IBM for example has done a ton of work. A Facebook engineer has contributed a HUGE amount of work to bring it up to speed on Windows (without WSL or Cygwin). And Google will end up contributing on all fronts if they continue to push it in the ML space.
- ynx 7y agoSwift does run on Linux and Windows. Getting to usable is a function of community; waiting for one means you won't be a part of helping build it.
- rezeroed 7y agoA recent update on OCaml multicore: https://discuss.ocaml.org/t/multicore-prerequisite-patches-appearing-in-released-ocaml-compilers-now/4408 https://discuss.ocaml.org/t/multicore-prerequisite-patches-a...
- gbersac 7y agoDid you tried scala? A quite mainstream functionnal programming language inspired by the ML family. I personally love it.
- alexeiz 7y agoScala is too big and complex. I tried to learn it, but ended up using it as a better Java with some functional features like pattern matching. I felt like it wasn't worth to continue mastering Scala after a certain point.