Hacker News new | past | comments | ask | show | jobs | submit login

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.

[1] https://github.com/gleam-lang/gleam [2] https://nim-lang.org/ [3] https://crystal-lang.org/


There's also Elchemy which is semantically and syntactically like Elm but compiles down to Elixir:

https://github.com/wende/elchemy


> 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.


Do you have more info about this? It does sound promising.


woah. how did I miss that? from everything I've been reading there's a bunch of projects but they're all still in very early stages.


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.

That said, I'm also playing around to try to help make this happen: https://github.com/ityonemo/mavis


I suggest that in repentance for dashing my hopes you ensure that this will come true ;).


Aren't there already elixirc hooks which have been in place for a while now? Are there new ones as of recently?


Source on this?


Use whatever you feel it takes to get the job done? The above kind of derails this thread, tbh.

Speaking about Elixir/Erlang alone, it's an interesting experience, because learning it properly is very different to almost every other language.

So if you're keen on moving to a new language for the sake of intellectual curiosity, then you will probably enjoy the trip.


It depends how mature you want your community to be... but there's also Crystal (https://crystal-lang.org/) with Amber (https://amberframework.org/).


Why C# and not F#?

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.


Ocaml/ReasonML checks all the boxes you listed. The tool chain is extremely mature and it's pretty easy to pick up.


I thought ReasonML only had tooling for front-end use - is there a mature way to use for backend development too?


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.

My advice is to stick to OCaml.


Yeah I don't actually like ReasonML and don't think it should exist. OCaml's syntax is great and easy to use.

Ocaml is a seriously underrated language and would be my goto choice for developing a native or webapp.

I would still use Scala for backend development, though. The JVM is kind of a drag, though.


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.


I feel the same way. I really want to jump into Elixir but the dynamic typing really puts me off.


It sounds like you want Node + Typescript.

Can be written functionally, everything is typed, very active community




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: