Skip to content

Comment on Ruby and Elixir: Polyglottin' FTW

Comments

Yeah, be polyglot by speaking American English and British English! I mean, Ruby and Elixir!

http://satwcomic.com/multi-language/moby-is-a-dick

That's like claiming any two C syntax inspired languages are the same because they share curly braces, semicolons and naming conventions.

While Ruby and Elixir have quite similar syntax, their underlying run time models are fundamentally very different.

Yes very different model, and you realize that the syntax is not so similar once you really start working with Elixir: you start using constructs that don't belong to procedural languages at all.

Similarities don't go much further than def do end (but there are too many do and too many different def in Elixir) and the sensible naming of some Library.functions() to match classes and methods in Ruby's standard library. But hey, making a good first impression is extremely important and Elixir has been engineered well in that regard. It's not one of those I'll-never-ever-be-able-to-read-it languages.

Yeah, I wonder if Elixir's superficial similarity to Ruby was actually a mistake. It makes some people think they can just write Ruby and have it run faster, only to become frustrated, and others scoff at it due to prejudice against Ruby. On the other hand, I think it has a really nice syntax that works very well for its semantics, so from a purely technical standpoint it was a good choice.

This is an open acknowledged issue on elixir-lang-core mailing lists. Many requests to make Elixir behave like Ruby are shot down. Often, what is requested already has a powerful analog in Elixir. If not, a lot of thought goes into how to add said feature according to Elixir idioms and style rather than blindly porting from Ruby.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.