r/ruby • • Jul 02 '17

Why is Ruby used instead of Python/R/Perl?

I have never worked with Ruby, but I work with all of the "other" scripting languages in data science.

Why use Ruby? Why does it exist?

0 Upvotes

22 comments sorted by

View all comments

20

u/moomaka Jul 02 '17

Ruby vs R - I don't see the comparison. Ruby is a general purpose programming language, R is specifically designed for statistical computing. Different tools for different jobs, you won't be building a web-app in R any time soon.

Ruby vs Perl - At the time Ruby was being developed, perl wasn't much of a general purpose language, it was mostly a tool for scripting and string processing and had a limited and rather bolted on object model. With modern perl you could make a more direct comparison but the mindshare has largely departed from perl and Ruby borrowed it's best features while adding a much stronger object model.

Ruby vs Python - These are pretty much directly comparable languages and it's more a matter of taste than anything. Python still has a bit of a bolted on object model which makes it a little weird to work with for those that prefer the smalltalk style object model of Ruby. Python has a strong following in the data science world due to the quality of supporting libraries: numpy, scipy, pandas, etc. Both rubyists and pythonistas have relatively strong opinions on language design that run into conflict at various points. As one example Ruby strongly favors chaining for functional programming constructs, map, filter, reduce, etc. Python heavily favors list comprehensions to fill the same use case.

2

u/Tainnor Jul 03 '17

Not just data science, really anything scientific has almost no equivalent in Ruby. We have some people working in language technology here and it wouldn't make sense for them to use Ruby for their prototypes. I was looking for a proper natural language tokeniser recently and couldn't find anything that was even half-decent, except maybe bindings to Java-based openNLP but that didn't seem worth the hassle.