As someone with a background in Objective-C, Swift, C++, C# and Java, and currently using Ruby, I'm looking for my next language for web development. Elixir sounds like a step up from Ruby, but I really miss static typing, and I find it hard to justify investing time in yet another language that doesn't have it.
But what are the alternatives? I'm looking for something with static typing, good editor support, mature community projects (e.g. testing on par with rspec), faster than Ruby (though most statically typed languages tend to be) and if it supports some functional paradigms that could be a plus (I dabbled in F# and SML previously).
- Scala is an option, but build times sound like an issue, and the JVM is a bit 'heavy' (e.g. startup times, min memory usage).
- Haskell sounds cool, but maybe a bit too esoteric? (i.e. is it worth the trouble, does it have all the middleware I'm used to)
- C# could be an option, but is the open source/community support there? (if you're not a corporate shop, doing corporate things).
- And then there's Rust, which I'm fascinated by, but I'm also worried that I'll be less productive worrying about lifetimes all the time, and that it's less mature (though growing fast, and seems to have attracted an amazing community of very talented people).
I'm also interested in ways to use a language like that in the frontend - Scalajs sounds pretty mature, C# has Blazor and Rust seems like one of the best ways to target WebAssembly.
So what is a boy to do? Stick to Ruby until the Rust web story is more mature? Try out Elixir in the meantime? Join the dark side and see what C# web dev is like these days? It can be really hard evaluating ecosystems like that from the outside.
Gleam[1] is a typed language on the BEAM. It's still in its early days, more so than Rust. May still be worth keeping an eye on. Nim[2] and Crystal[3] also exist. No idea what their web situation is like, but Nim has a JS compile target, that might be interesting.
> but [in Rust] I'm also worried that I'll be less productive worrying about lifetimes all the time
I'd avoid getting too concerned about this! Explicit lifetime annotations are nowhere near as prevalent in 'modern' (2015+) Rust as they were in the early days, and it's somewhat rare to need to think about them.
The most helpful advice I had on this was to avoid passing references in Rust beyond simple cases unless there is a real need - owning data is much simpler, and clones are generally fine until you get to optimising a program.
If you're interested in Rust for web dev, now is a great time to jump in - while not as mature as Ruby or C# in terms of ecosystem, Rocket is now usable with stable Rust, and Warp is (IMO) a close-to-best-in-class library for building HTTP servers.
I spent the last 8 months learning Elixir, Ecto & Phoenix etc... I am about to leave it and spend more time in C# as I really miss static typing, I also miss the way the documentation is written, the amount of material to read on .net and C#. The library, community and packages are richer for a start. Will be interesting to see if I miss Elixir at all.
If you're willing to be patient, I think that in the next year Elixir is going to get an add-in aggressive static typing library (better than dialyzer) enabled by compiler hooks. It's going to happen, and it's going to be very good.
I'm very very Sorry I should have been less emphatic, less flippant. This is an unsubstantiated prediction based on what elixirc hooks will enable and what the community wants, but the momentum has swung to the point where I think it's inevitable and the timeframe is correct, +/- 6 months.
I've been learning F# and OCaml the last couple weeks and I really like the syntax. (I have been using elixir for 4 years)
The main thing I don't like about OCaml is that it doesn't have method overloading. I love the arity-based (number of arguments in a function) function signatures in elixir but that's not possible in OCaml since it curries methods.
e.g. in ocaml, calling method with less arguments than expected will return a function that takes the remaining arguments:
let add = (fun x y -> x + y)
let add_four = add 4 (* returns a function expecting 1 arg*)
add_four 5 (* returns 9 *)
Not a big deal but I would rather lose this built in currying in exchange for arity-based method overloading.
Otherwise, OCaml is a fast language, both compiling and runtime performance.
I agree that the lack of polymorphism is annoying. A solution to this would be modular implicits. This would allow the built-in currying to work as well.
It's just an OCaml syntax layer, so yeah. You just use the normal tools and the build system just does the right thing. Interspersing reason and OCaml files in a single project works fine too.
This. Although I would not use Reason since the compiler layer, bucklescript, changed its name to Rescript to rebrand as its own frontend language and left Reason holding the bag. There is no reference to OCaml in any documentation that was once under the bucklescript project. It even created its own sytax that is different than Reason and Ocaml to something more like JavaScript.
It basically should have been a new project and have had nothing to do with bucklescript.
The worst part is that the owner of bucklescript even owned some properties that had the name "reasonml" in it (like reasonml.org and the reasonml discord group, which weren't owned by the Reason team) and then he pointed all those thing to Rescript. Just the confusion did some serious damage to Reason.
If JVM isn't a blocker try Kotlin. It compiles faster than Scala and has a great IDE experience. Runtime performance is very good of course with the usual JVM caveats (high memory usage, need to use recent JDK for latency optimised GC if you need that).
Could be worth your time to check out vapor, the server side swift web framework. Obviously doesn’t have the ecosystem as the more popular frameworks but has been under active development with corporate sponsorship for a few years now.
> Elixir sounds like a step up from Ruby, but I really miss static typing, and I find it hard to justify investing time in yet another language that doesn't have it.
Static typing serves basically two purposes: correctness through static type analysis and enabling compiler optimizations.
Like many languages that don’t mandate static typing, Elixir has available static type analysis solutions; in Elixir's case (as for Erlang) it's Dialyzer, which does more static analysis than just what is usually thought of as typechecking.
I love Elixir but i will never advocate Dialyxir for somebody looking for static typing. It's super slow, it's not as powerful and rarely (but sometimes) it rejects programs that are valid.
But what are the alternatives? I'm looking for something with static typing, good editor support, mature community projects (e.g. testing on par with rspec), faster than Ruby (though most statically typed languages tend to be) and if it supports some functional paradigms that could be a plus (I dabbled in F# and SML previously).
- Scala is an option, but build times sound like an issue, and the JVM is a bit 'heavy' (e.g. startup times, min memory usage).
- Haskell sounds cool, but maybe a bit too esoteric? (i.e. is it worth the trouble, does it have all the middleware I'm used to)
- C# could be an option, but is the open source/community support there? (if you're not a corporate shop, doing corporate things).
- And then there's Rust, which I'm fascinated by, but I'm also worried that I'll be less productive worrying about lifetimes all the time, and that it's less mature (though growing fast, and seems to have attracted an amazing community of very talented people).
I'm also interested in ways to use a language like that in the frontend - Scalajs sounds pretty mature, C# has Blazor and Rust seems like one of the best ways to target WebAssembly.
So what is a boy to do? Stick to Ruby until the Rust web story is more mature? Try out Elixir in the meantime? Join the dark side and see what C# web dev is like these days? It can be really hard evaluating ecosystems like that from the outside.