Live data from Hacker News

Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

youtube.com

31–40 of 50 posts

Re: Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

#31
post #27

Earlier quoted context omitted.

All that being said, Ruby is much more like Smalltalk than Elixir or Erlang are. Smalltalk does have inheritance and classes, and does the kind of meta stuff easily that Ruby supports. Objects and classes are as central to Smalltalk's design as message passing is.

To touch on what digitalzombie said however, Kay did not originally picture inheritance as being part of OOP.

He is even against it and made it clear a couple time.

Classes in general hurt.

Re: Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

#32

I am falling for Elixir. However, my big drawback that made me stay in Ruby is the community don't seem to like NoSQL solutions like MongoDB and you can feel it in the libraries and global architecture.

Because the erlang community (and core member of the elixir community) have quite a lot of experience with distributed systems and alternative to SQL.

They know where the skeletons are and avoid things that are bad ideas in that are if possible.

Re: Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

#33

Earlier quoted context omitted.

It's different, but I'm not sure that makes it better than Ruby. You listed three advantages for Elixir. Are there none for Ruby? Language design involves tradeoffs. Are there no tradeoffs for being immutable and functional?

You're right that there are always tradeoffs, but it isn't clear that Ruby takes the other side of many of Elixir's. Some examples: Elixir requires a VM installed on the target machine (unlike Go, C, C++, etc.), it doesn't have strong type checking (unlike Java, Scala, Haskell, etc.), it doesn't have a strong data science story (unlike Python and R), it can't be conveniently used as a dual front- and back-end languag…

For the limited number of mathy things I've done in Elixir, performance has been pretty terribly. Ruby is a bigger language which means it's more likely to have C binding for things like generating prime numbers, for example.

Fortunately, Rustler is making adding safe native extensions much easier. https://github.com/ddresselhaus/primal_ex is a little toy library I wrote to leverage a really excellent Primal Rust library. I'm excited about the possibilities Rustler brings to the table.

Re: Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

#34
post #3

I think it comes down to this: with Elixir, you gain a lot over Ruby and lose very little. Any Elixir app will be significantly more performant and reliable than its Ruby counterpart. This is due to several reasons: - Elixir runs on a battle-tested virtual machine, and stuff like supervisor behavior (e.g. auto-restart of crashing processes) is built right in - Elixir is a functional language, which makes the code you…

I love Elixir, and came from Ruby. I do find it hard to describe to people why I like it more it more. There is no one thing that is a killer feature to me. I do not miss inheritance at all.

Pattern matching, to me, is the killer feature. It allows me to write so many fewer if statements, which to me is a big boon.

Re: Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

#35
post #30

Earlier quoted context omitted.

Elixir isn't an object-oriented language.

alternatively it is the most object oriented language

Haha, nice observation. But not really. The only facet of object orientation is processes communicating with message-passing semantics. Primitive types are not objects, and processes are not instances of a class for example.

Re: Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

#36
post #6

Earlier quoted context omitted.

Former Ruby, now Elixir, developer here and I agree. The one use case where Ruby still wins for me, though, is a little one-off script. Last time I had occasion to do that, I found you couldn't use any Elixir hex packages without generating a whole mix application. In ruby you could just globally install the gem and require it right into your script. I forget why this came up, but I think it was something like just w…

Mix tasks are what you're looking for. You put them inside your application (we have them in /appa/your_app /lib/mix/tasks), define a run/1 function that takes in args, say "use Mix.Task", then you can make sure that things like Ecto are loaded and interact with your program's major entities, or use Poison or whatever it is that you care to do.

....

Or you could create a script.rb file, anywhere, and require gems if needed. Then type ruby script.rb.

That takes no time at all, and using gems is extremely simple even with RVM if wanted.

Re: Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

#37

Earlier quoted context omitted.

Mix tasks are what you're looking for. You put them inside your application (we have them in /appa/your_app /lib/mix/tasks), define a run/1 function that takes in args, say "use Mix.Task", then you can make sure that things like Ecto are loaded and interact with your program's major entities, or use Poison or whatever it is that you care to do.

.... Or you could create a script.rb file, anywhere, and require gems if needed. Then type ruby script.rb. That takes no time at all, and using gems is extremely simple even with RVM if wanted.

That works for quick and dirty scripts but it's not portable if you want to distribute it to others.

Re: Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

#38
post #3

Earlier quoted context omitted.

I love Elixir, and came from Ruby. I do find it hard to describe to people why I like it more it more. There is no one thing that is a killer feature to me. I do not miss inheritance at all.

Pattern matching, to me, is the killer feature. It allows me to write so many fewer if statements, which to me is a big boon.

Here's a list of things Elixir things I love:

- pattern matching

- immutable data

- built-in supervision tree

- async message passing w/ mailboxes

- networking modules

- much of Elixir is written in Elixir

Here's stuff I'd like to see in the standard library (which may come over time anyway):

- Better time/calendar options (I still like using Timex)

- Rational numbers

- Ruby's BigDecimal in Elixir

- Dialyzer for Elixir

- No need to mess w/ Erlang data types (looking at you charlists)

- Better semantics for process registry

- Documentation on parallel testing options

Re: Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

#39
post #6

I think it comes down to this: with Elixir, you gain a lot over Ruby and lose very little. Any Elixir app will be significantly more performant and reliable than its Ruby counterpart. This is due to several reasons: - Elixir runs on a battle-tested virtual machine, and stuff like supervisor behavior (e.g. auto-restart of crashing processes) is built right in - Elixir is a functional language, which makes the code you…

Former Ruby, now Elixir, developer here and I agree. The one use case where Ruby still wins for me, though, is a little one-off script. Last time I had occasion to do that, I found you couldn't use any Elixir hex packages without generating a whole mix application. In ruby you could just globally install the gem and require it right into your script. I forget why this came up, but I think it was something like just w…

I like Ruby for one off scripts, too. In some cases though, I don't like having to install Ruby. If Elixir, or perhaps Erlang, is on the target box, an Elixir Escript is also a good option. I've picked up a fair bit of bash for easier tasks, too.

Re: Ruby vs Elixir – Panel discussion at Wroc_love.rb [video]

#40

Earlier quoted context omitted.

It's different, but I'm not sure that makes it better than Ruby. You listed three advantages for Elixir. Are there none for Ruby? Language design involves tradeoffs. Are there no tradeoffs for being immutable and functional?

You're right that there are always tradeoffs, but it isn't clear that Ruby takes the other side of many of Elixir's. Some examples: Elixir requires a VM installed on the target machine (unlike Go, C, C++, etc.), it doesn't have strong type checking (unlike Java, Scala, Haskell, etc.), it doesn't have a strong data science story (unlike Python and R), it can't be conveniently used as a dual front- and back-end languag…

That's not entirely accurate. An Elixir release compiled for the target platform can be bundled up in a tarball with everything it needs to run, including the runtime. No Elixir install required. I do agree that pushing around a single binary in general is easier, all other things being equal.
Post reply on HN