4 ms·
Elixir is the closest thing to OCaml that has a chance at semi-mainstream usage IMO. It has basically all of the stuff about functional programming that makes
by japhib 11mo ago
Elixir is the closest thing to OCaml that has a chance at semi-mainstream usage IMO.
It has basically all of the stuff about functional programming that makes it easier to reason about your code & get work done - immutability, pattern matching, actors, etc. But without monads or a complicated type system that would give it a higher barrier to entry. And of course it's built on top of the Erlang BEAM runtime, which has a great track record as a foundation for backend systems. It doesn't have static typing, although the type system is a lot stronger than most other dynamic languages like JS or Python, and the language devs are currently adding gradual type checking into the compiler.
- DrewADesign 11mo agoI think it’s odd that elixir doesn’t get more love. It ticks a lot of boxes that folks here get excited about, has a great ecosystem and tooling, BEAM is great, and it’s much more syntactically familiar than erlang to my eye. I know of a couple companies aside from the perennial goto examples that built sizable saas products backed by it.
- skybrian 11mo agoWhat does deployment look like? Can you get a static binary easily like with Go?
- crdrost 11mo agoYou don't get it from language tooling because you are compiling to a bytecode that runs in a virtual machine (BEAM). The current tool to wrap your bytecode with a VM so that it becomes standalone is Burrito[1], but there's some language support[2] (I think only for the arch that your CPU is currently running? contra Golang) and an older project called Distillery[3]. 1: https://github.com/burrito-elixir/burrito https://github.com/burrito-elixir/burrito 2: https://hexdocs.pm/mix/Mix.Tasks.Release.html https://hexdocs.pm/mix/Mix.Tasks.Release.html 3: https://hexdocs.pm/distillery/home.html https://hexdocs.pm/distillery/home.html
- pluralmonad 11mo agoElixir is good at managing complexity. I love flattening hierarchy and dealing with edge cases right in function definitions using pattern matching. Every other language without it just feels crippled after getting used to the feature.
- cardanome 11mo agoThe backend work I do is just super boring. I always wanted to learn Elixir but never had a project where it could show it strengths. Good old PHP works perfectly fine. Also corporations like their devs to be easily replaceable which is easier with more mainstream languages, so it is always hard for "newer" languages to gain traction. That said I am totally rooting for Elixir.
- DrewADesign 11mo agoI think it’s great for boring stuff — the Phoenix web framework is really straightforward. Learning a whole new language paradigm and environment for a professional project you need to be productive in ASAP is definitely the worst kind of ‘not boring’ though. I know of a Haskell shop and everybody said they’d have a hell of a time finding people… but all them nerds were (and are) tripping over themselves to work there because they love Haskell… though some I’ve talked to ended up not liking Haskell in production after working there. There seems to be a similar dynamic, if a bit less extreme, in Elixir shops.
- lenkite 11mo agoThe BEAM VM executing bytecode is slower than a compiled binary. Sure, it is great when compared to Python and other interpreted languages. Not so much when you need fast processing and raw CPU performance. It also loses out to the JVM in performance, but wins in memory consumption.
- DrewADesign 11mo agoBut how many things involve fulfilling basic requests over a network pulling information from a database? Most things just don’t need that kind of performance.
- lenkite 11mo agoSure for basic, dead CRUD, the choice of middleware language rarely makes any difference. But even bog-standard business processes eventually find the need for data-processing, crypto and parsing - the use-cases where people code Elixir NIF's. That is why for example you have projects like html5ever_elixir for parsing HTML/XML. Another use case is crypto - you have NIF's for several crypto libraries. Data processing - there are NIF's for Rust polars.
- DrewADesign 11mo ago> Sure for basic, dead CRUD From a technical perspective, this is the overwhelming majority of what makes the Net happen. BEAM is great for that and many other things, like extremely reliable communication streams. Use the right tool for the job. Rust sucks for high-level systems automation but that doesn’t make it any less useful than bash. It’s all about about use cases and Elixir fits many common use cases nicely, while providing some nice-to-haves that people often ask for in other common web dev environments.
- dmpk2k 11mo agoIt is slower, but a big cause of the slowness is a lot of copying (immutable data structures and separate heaps for every process). Nowadays the BEAM has a JIT. If you use type guards correctly the performance can be surprisingly good. Not C/C++/Rust/Go/Java good, but not too far off either. This is definitely a corner-case though.
- phplovesong 11mo agoGleam also. But i cant justify a non compiled language in many things i do.
- cultofmetatron 11mo agogleam is compiled... to erlang bytecode
- seafoamteal 11mo agoIt's compiled to Erlang, not BEAM bytecode, as the latter is not a stable, backward-compatible API to target, and you lose all of the optimization work put into the Erlang compiler. It's also compiled to JavaScript, so it can run on both the front-end and back-end.
- phplovesong 11mo agoI want a static binary. Not some IR i run on some VM.
- vvpan 11mo agoIf it's functional (recursion vs imperative loops) most people/organizations will not use it. At this point that is just the reality.
- zaphar 11mo agoHaving loops is not the defining feature that separates functional from imperative. Where did this idea come from? I'm suddenly seeing it in a lot of places.
- gmadsen 11mo agoits a simplification of immutability and its consequences
- vvpan 11mo agoIt is not the defining feature but loss of the loop is one of the most obvious differences for people who look at a functional language Rust has immutability, pattern matching, etc, but it remains an imperative language with "some functional features". Or this is my subjective analysis.
- jlouis 11mo agoYou can be functional "in spirit" more than purely functional. OCaml and Standard ML falls into this category. Ocaml has loops for instance. You might just not see many loops if code is written by OCaml developers, because there's frankly no need to use them in a lot of places. You often want to lift the abstraction level of iteration to an arbitrary data structure such that you get freedom of implementation. See Applicative and Monad.
- int_19h 11mo agoBut, again, loops aren't automatically imperative per se. Consider loop / recur in Clojure for an example. For someone coming from JavaScript, it's not really much different from writing a while loop where every branch has to terminate with an explicit break or continue.
- 11mo ago
- cyberpunk 11mo agoimmutability? Interactive Elixir (1.19.0) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> x = 1 1 iex(2)> x = 2 2 iex(3)> What's immutable about elixir? It's one of the things which I MISS from Erlang -- immutability.
- nitros 11mo agoThis is like saying Haskell doesn't have immutability because it has the state monad, or that rust doesn't because you can shadow with let. Data is immutable and thats much more important than whether local variables can be modified imo.
- deleted 11mo ago[deleted]
- debugnik 11mo agoShadowing is not mutability. The former isn't affected by control flow nor does it affect closures.
- int_19h 11mo agoWhat you wrote is roughly equivalent to this in C: { const int x = 1; { const int x = 2; } } which is to say, there are two different `x` in there, both immutable, one shadowing the other. You can observe this if you capture the one that is shadowed in a closure: iex(1)> x = 1 1 iex(2)> f = fn () -> x end #Function<43.113135111/0 in :erl_eval.expr/6> iex(3)> x = 2 2 iex(4)> f.() 1
- BenGosub 11mo agoWriting OCaml and writing Elixir code is much different for me. OCaml requires more braincells, while Elixir is more flexible.
- BenGosub 11mo agoI think that a better question is why F# isn't a more popular language, since it's much closer to OCaml, than Elixir and you can use the whole Dotnet ecosystem in F#, which is one of the weakest points of OCaml (no libraries).
- schonfinkel 11mo agoThe answer is (most likely) Microsoft, I kid you not. I've worked with F# professionally for many years is its incredible how they are literally sitting atop a gold mine that is the output of Microsoft research and do basically nothing with it. Even though it's sold as an ecosystem, .NET revolves around C# and its related tooling. "Type Providers" are an example of such negligence btw, it's something from the early 2010's that never got popular even though some of its ideas (Typed SQL that can generate compile-time errors) are getting traction now in other ecosystems (like Rust's SQLx). My team used SQL Providers in a actual production system, combined with Fable (to leverage F# on the front end) and people always commented how our demos had literally 0 bugs, maybe it was too productive for our own good.
- deleted 11mo ago[deleted]
- belter 11mo agoBEAM performance model trades throughput for isolation, which hurts CPU-bound tasks, and ironically, whenever you need speed, you end up using NIFs that break BEAM safety guarantees, and reintroduce the exact fragility Elixir was supposed to avoid. In 2025, Elixir is a beautiful system for a niche that infrastructure has already abstracted away.
- jimbokun 11mo ago> In 2025, Elixir is a beautiful system for a niche that infrastructure has already abstracted away. Do you mean Kubernetes? My mental model of Erlang and Elixir is programming languages where the qualities of k8s are pushed into the language itself. On the one hand this restricts you to those two languages (or other ports to BEAM), on the other hand it allows you to get the kinds of fall over, scaling, and robustness of k8s at a much more responsive and granular level.
- creata 11mo ago> whenever you need speed, you end up using NIFs that break BEAM safety guarantees, and reintroduce the exact fragility Elixir was supposed to avoid. That's like complaining that unsafe{} breaks Rust's safety guarantees. It's true in some sense, but the breakage is in a smaller and more easily tested place.
- jlouis 11mo agoIt's not isolation which hampers throughput. That's a red herring. In fact, isolation increases throughput, because it reduces synchronization. A group of isolated tasks are embarrassingly parallel by definition. The throughput loss stems from a design which require excessive communication. But such a design will always be slow, no matter your execution model. Modern CPUs simply don't cope well if cores need to send data between them. Neither does a GPU.
- creata 11mo agoBut the isolation is what necessitates (or at least encourages) a design that requires more communication, isn't it?
- timeon 11mo agoI do not think that monads/type system are issue, but yes BEAM runtime is killer feature.