News for hackers. Stuff that matters.
Re:New Machine Learning Gems for Ruby by awesomeusername on Sunday June 20, 2021 @12:35AM (#27567104)
One of my greatest disappointments in life is that programmers don't give a shit about the actual experience of using a particular language and it's ecosystem, and instead go full sheep mode and follow the crowd for whatever reasons they think are valid.

I don't hate python but it's existence is the main brake slowing ruby down.

I enjoy programming in Ruby. As the years roll by and I get more grey hairs the enjoyment I get from other languages descends to just toiling away and wasting one's life.

Thank fuck for Ruby

Re:New Machine Learning Gems for Ruby by jlos on Sunday June 20, 2021 @01:57AM (#27567522)
I enjoy several languages but Ruby definitely ruined python for me. I used to think python seemed elegant, but everytime I've had to work with it lately I just wish it was Ruby.
Re:New Machine Learning Gems for Ruby by joelbluminator on Sunday June 20, 2021 @02:28AM (#27567667)
A lot of people care and Rails isnt going anywhere. But we need to be realistic about winning the data science battle...that ship has sailed.
Re:New Machine Learning Gems for Ruby by echelon on Sunday June 20, 2021 @02:49AM (#27567759)
> I don't hate python but it's existence is the main brake slowing ruby down.

Flipside, I love Python and hate Ruby. It's easy to use Python idiomatically, and this design deters bad behavior from "clever geniuses". Ruby code I've had to maintain is full of mixins, dynamic dispatch, and magical behavior from a distance. This is why I love Rust so much despite the fact that it feels like Ruby at a superficial level - it doesn't want you to be clever.

But I feel the same way you do about PHP.

> "it's existence is the main brake slowing [...] down."

Maybe Ruby could focus on winning over the PHP community instead of trying for the data science community.

Re:New Machine Learning Gems for Ruby by fake-name on Sunday June 20, 2021 @04:13AM (#27568130)
I've had exactly the same experience.

I had to do some hacking on discourse (the OSS forum package), and the amount of magic and difficult-to-follow logic is super high.

Basically, ruby is the new perl, as far as I can tell.

Re:New Machine Learning Gems for Ruby by Banana699 on Sunday June 20, 2021 @04:59AM (#27568331)
>ruby is the new perl

What's new in ruby? it's there since 1995, and the connection to perl was an explicit influence in its design.

Re:New Machine Learning Gems for Ruby by cutler on Sunday June 20, 2021 @01:22AM (#27567349)
... and Clojure. These two stand out as the most elegantly designed creativity-enhancing programming languages. The rest are mainly a set of constraints. Python is the VHS of programming languages with its pathetic lambdas.
Re:New Machine Learning Gems for Ruby by toxik on Sunday June 20, 2021 @05:57AM (#27568606)
This may surprise you, but using lambda is considered a sign of bad programming practice in Python.

In general, this whole thread completely misses the point Python makes. Do not invite “clever” language (ab)use. Do the straightforward thing.

Re:New Machine Learning Gems for Ruby by cutler on Sunday June 20, 2021 @09:45AM (#27569891)
> This may surprise you, but using lambda is considered a sign of bad programming practice in Python

Only by its BDFL. Most languages consider lambdas to be first class so why not let the user decide?

Re:New Machine Learning Gems for Ruby by toxik on Sunday June 20, 2021 @11:42AM (#27571141)
Because the user makes poor choices, that’s the point - don’t do the clever thing, do the straightforward thing. Lambdas are discouraged in Python, and that’s not just something Guido van Rossum thinks (who, by the way, is not BDFL - there is none anymore and there hasn’t been for a long time now.)
Re:New Machine Learning Gems for Ruby by cutler on Sunday June 20, 2021 @05:45PM (#27574189)
If lambdas are clever then so is most Node.js code. Guido may have stepped down but he was responsible for this "Pythonic" attitude to lambdas. It's like the Python community is parodying Matz with "Guido hates FP therefore we hate FP".
Re:New Machine Learning Gems for Ruby by arcturus17 on Sunday June 20, 2021 @05:29AM (#27568481)
Lambda syntax is indeed horrible in Python. I hope some day they do something to fix it… Otherwise I really enjoy the language and the ecosystem.
Re:New Machine Learning Gems for Ruby by truth_ on Sunday June 20, 2021 @01:54AM (#27567506)
What do you think about Elixir in this context? Is it not "creativity-enhancing" enough?
Re:New Machine Learning Gems for Ruby by cutler on Sunday June 20, 2021 @09:49AM (#27569930)
Elixir doesn't have an array/vector implementation. Instead it has to borrow Eralng's ugly offering or hack Map with numeric keys as in PHP.
Re:New Machine Learning Gems for Ruby by beakerbreaker on Sunday June 20, 2021 @10:19AM (#27570256)
There is some exciting development on that front by building on XLA.

https://github.com/elixir-nx/nx/tree/main/nx

Re:New Machine Learning Gems for Ruby by cutler on Sunday June 20, 2021 @11:09AM (#27570768)
So I can get a cutting-edge PyTorch/TF multi-dimensional array with Nx but Elixir itself still has no basic built-in vector? I don't get it.
Re:New Machine Learning Gems for Ruby by fny on Sunday June 20, 2021 @01:44AM (#27567462)
People don’t go full sheep mode. They just invest in an ecosystem, and don’t want to waste time looking for a new hammer.

Part of what has also kept Ruby lagging is also cultural. It’s not a language that was ever adopted by engineers but rather artists, and it took a while for these artist types to realize performance actually matters.

Python, on the other hand, always had an avid base of CS oriented folk that helped drive the language forward technically. Ruby instead only had Rails, which was a productivity marvel rather than a technical one.

Re:New Machine Learning Gems for Ruby by randmeerkat on Sunday June 20, 2021 @02:47AM (#27567746)
> Part of what has also kept Ruby lagging is also cultural. It’s not a language that was ever adopted by engineers but rather artists, and it took a while for these artist types to realize performance actually matters.

… are none of the engineers that work at GitHub (Microsoft) CS oriented folks?

> Ruby instead only had Rails, which was a productivity marvel rather than a technical one.

… are productivity marvels and technical marvels mutually exclusive?

Re:New Machine Learning Gems for Ruby by WJW on Sunday June 20, 2021 @07:17AM (#27568993)
Not necessarily, but Rails is much more a productivity marvel than a technical marvel tbh. This is as it should be for a productivity oriented tool, not surprising users with technically advanced stuff is a feature in that case.

And sure, some of the engineers at Github/Shopify/etc are super qualified but from my personal experience in the Ruby ecosystem (5+ years and counting) there are WAY more autodidact freelancers who can throw up new websites in minutes but still struggle with computing the algorithmic complexity of linked lists than there are CS graduates who have a solid grounding in data structures and algorithms. In such an environment, it is not surprising that many of the available libraries are very business-oriented but not very optimized.

Re:New Machine Learning Gems for Ruby by jbverschoor on Sunday June 20, 2021 @02:57AM (#27567800)
The CS/tech industry is full of toxic elitists, who get off at seemingly complex or over architected things.

Ruby and it’s ecosystem make things look easy. So easy that anybody can create software.

The elitists fail to see that creating such an ecosystem is where true skills and thinking required. Funny part is most of them ARE sheep, and make so many basic and architectural mistakes. They simply like to feel superior to others.

Re:New Machine Learning Gems for Ruby by mperham on Sunday June 20, 2021 @09:56AM (#27569997)
But Ruby is just as fast as Python in most of the comparisons I’ve seen.

It is true IME that usability and compatibility, not performance, are Matz’s first concern.

Re:New Machine Learning Gems for Ruby by f6v on Sunday June 20, 2021 @03:57AM (#27568059)
I love Ruby more than Python. But I’ve got to admit it can be much more confusing and the learning curve is steep. I mean, getting to the point where you love and appreciate Ruby is a lot of work.
Re:New Machine Learning Gems for Ruby by sensanaty on Sunday June 20, 2021 @08:22AM (#27569325)
Really, compared to Python? I'm genuinely curious why you think so, it's the exact opposite for me.

Can't tell you the amount of times I've been able to just put pseudocode down in Ruby and have it work somehow, the language is beautiful

Re:New Machine Learning Gems for Ruby by f6v on Sunday June 20, 2021 @10:01AM (#27570039)
Maybe I’m wrong but things like 3.times { ... } are more prevalent in ruby than in other languages. There’s optional return statement (do I put it or not?), strings vs symbols, hash conventions ({ hello: :world } vs { “hello” => “world” }, people still use both), optional parenthesis in method calls, etc. I think ruby gives more ways to do the same thing, but that’s confusing for a newcomer. That being said, it’s my favorite language.
Re:New Machine Learning Gems for Ruby by sensanaty on Sunday June 20, 2021 @12:10PM (#27571421)
That's true, but I think for a beginner having more ways to do things is also nice, since you have the freedom of doing any one thing in multiple ways. Once you're more comfortable with the language, you don't even really think about it, you just pick what you prefer and what makes sense in the given context.

I'll address the points you made since I love talking about Ruby lol, hope you don't mind!

I'm not sure what you mean with the 3.times {} point. I personally prefer the 3.times do ... end syntax, because it's basically English, it makes it very easy to comprehend what's happening as a beginner. You're doing a thing 3 times, it might as well be pseudocode. IMO it's much more elegant than the whole for (i = 0; i < 3; i++) syntax that's more common in other languages.

The optional return thing I'd agree with, it can lead to some confusing situations. Even after years of Rubying, I sometimes get caught by an unexpected return, especially if I'm working in other langs for a bit. Though if you just disable Rubocop's warnings, you can put a return in no problems! I even encourage beginners to explicitly put in returns, so that the methods they write do what they intend them to do. Didn't intend to return that specific thing there? Now it's clear!

What specifically about strings and symbols? The only caveat that I can think of is that symbols are immutable whereas strings are not , but I don't know how often beginners come across situations where they're confronted with symbols outside of a Hash anyway.

The hash conventions are simply a matter of legacy code. I forget when the rocket (=>) syntax was 'replaced', for lack of a better word, but that's just because before a certain version of ruby you couldn't do the foo: :bar syntax. For legacy purposes, the rocket one remains, but in my experience most people writing modern ruby stick with the foo: :bar convention.

I'd also agree with the optional parenthesis bit, though again for beginners I just tell them to always put parens since it makes it easier to reason about methods.

Re:New Machine Learning Gems for Ruby by f6v on Sunday June 20, 2021 @01:56PM (#27572359)
There’s a chance component to why Python is so popular in data analysis. But I’ve seen many non-programmers get into computational science. Like biologists doing bioinformatics. And my gut feel is it’be harder to get them into Ruby compared to Python. I have experience explaining tidyverse vs vanilla in R. Tidyverse libraries have a lot of synthetic sugar as well. But it’s challenging to get newcomers to appreciate it, because you have to always go an extra mile to explain what it means. Whereas vanilla(and Python) is closer to what they studied in CS101. So the whole machine learning for ruby is going to be very niche.
Re:New Machine Learning Gems for Ruby by dcoo on Sunday June 20, 2021 @09:50AM (#27569935)
"Matz is nice and so we are nice"
Re:New Machine Learning Gems for Ruby by dmitriid on Sunday June 20, 2021 @02:04AM (#27567555)
Instead of being disappointed you could try and analyze why Ruby is lagging so behind Python. Perhaps it's Ruby itself that is the greatest brake and not Python?

After all, people did flock to Python for integration with scientific, math and machine learning libraries, not to Ruby.

There are some musings, for example, here: https://twitter.com/zverok/status/1365014133180141578?s=20

Re:New Machine Learning Gems for Ruby by ajmurmann on Sunday June 20, 2021 @09:56AM (#27569993)
Mh, it seems that the Twitter thread mostly focuses on the legacy in terms of language design and then blames much of the demise on there never having been a real killer application that showcased it (as the author pointed out and I agree with Rails worked because of Ruby but didn't showcase it well). I didn't see anything about actually faulty language design.
Re:New Machine Learning Gems for Ruby by dmitriid on Sunday June 20, 2021 @01:30PM (#27572140)
I never said the fault was with the language design
Re:New Machine Learning Gems for Ruby by joelbluminator on Sunday June 20, 2021 @12:52PM (#27571788)
A lot of things in life are coincidental and I think python adoption is one of them. Its not a bad language but neither is Ruby.