Live data from Hacker News

Ruby 3.0 Preview 1

ruby-lang.org

71–80 of 207 posts

Re: Ruby 3.0 Preview 1

#71

Earlier quoted context omitted.

Metaprogramming is an important part of ruby, so method_missing stays.

No, metaprogramming is a stain on software engineering that all ecosystems are moving away from. Except Ruby.

What evidence do you have of "ecosystems" moving away from metaprogramming? Last I checked, it was just as popular in C++ as it's ever been, and a number of high-profile new languages (Rust, Elixir, Nim) have made it a major selling point.

Re: Ruby 3.0 Preview 1

#72

I love Ruby and great to see Ruby love on hacker news. Just curious on how popular it is in the hacker news community ?

I only ever tried out a rails tutorial once, and coming from a C/C++ background, but having used with many languages, too many things felt like magic back then, but no further experience with the language itself, so can’t really judge it.

However, now I’m on the operational side of things, and there are 2 types of applications I avoid to deploy/maintain, mainly because of their runtime: Java and Ruby apps. It’s very likely the Ruby runtime has improved, but we actually set up a haproxy with multiple instances of the same ruby app, which we just restarted every 2 hours, just to keep it running properly. Upgrading ruby back-then was a mess, and could break a lot of things. I can’t comment on the language itself, but the runtime left a very bad impression. I since then (4/5 years ago or so) have successfully avoided ruby, so it’s possible things have improved, but first impressions last...

Re: Ruby 3.0 Preview 1

#73

>Rightward assignment statement is added. >fib(10) => x This is exactly the kind of stuff I hated when I had to work with ruby in my last gig and why I will never accept a job using it again - soo many pointless and inconsistent ways to do the same thing ... they have method aliases for collection operations like map/filter in standard library ! .NET went with non-standard SQL-like names (select/where) and I'm not a…

! means “dangerous”, not mutation. Yes, that’s how it plays out because it is one kind of danger, but it’s not inconsistent.

Re: Ruby 3.0 Preview 1

#74
post #32

Question: will the nonblocking scheduler start to make Ruby concurrency competitive with e.g. Node.js and Go? Currently Ruby mostly uses heavyweight threading mechanisms that cause trouble for I/O-bound microservices.

In theory the scheduler should be similar to NodeJS and Ractor should be similar to Go if they’re both applied correctly.

Really? Can you point me to details supporting this?

Re: Ruby 3.0 Preview 1

#75

>Rightward assignment statement is added. >fib(10) => x This is exactly the kind of stuff I hated when I had to work with ruby in my last gig and why I will never accept a job using it again - soo many pointless and inconsistent ways to do the same thing ... they have method aliases for collection operations like map/filter in standard library ! .NET went with non-standard SQL-like names (select/where) and I'm not a…

! means “dangerous”, not mutation. Yes, that’s how it plays out because it is one kind of danger, but it’s not inconsistent.

It's also not supposed to be used unless you have another method with the same name.

Also, what kind of danger are we talking here? I consider mutation dangerous. Danger could also mean it has side effects or that it can raise an error.

I wouldn't call it inconsistent but I would call it arbitrary.

I would rather just name the method "#{base_method}_#{why_its_dangerous}". For example take ActiveRecord::Base#save and #save!

#save mutates and I would consider that dangerous. #save! can raise an error. I would rather name #save! as #save_or_raise_if_invalid. I know it doesn't look as pretty and takes longer to type but I really don't care. Then again, I'm not a big fan of exceptions so I would never call it.

Re: Ruby 3.0 Preview 1

#77
post #21

My thoughts: - RBS: meh... might get more useful in the future (in 2-5 years maybe). - Ractor: Wohooo! I'm writing a DAG library where I was thinking of implementing something like this, good to know I can use it and get real parallelism on top. - Scheduler: :shrug: don't know about this one, might be relevant with future concurrent ruby code, any ideas? - Rightward assignment: it's a bit awkward but I see the use ca…

> - Endless method: this one is cute, I love it! It's a weird name for it. It should probably be called something like 'equational method definitions'

>It should probably be called something like 'equational method definitions'

Yeah, that's not weird

Re: Ruby 3.0 Preview 1

#78
post #75

Earlier quoted context omitted.

! means “dangerous”, not mutation. Yes, that’s how it plays out because it is one kind of danger, but it’s not inconsistent.

It's also not supposed to be used unless you have another method with the same name. Also, what kind of danger are we talking here? I consider mutation dangerous. Danger could also mean it has side effects or that it can raise an error. I wouldn't call it inconsistent but I would call it arbitrary. I would rather just name the method "#{base_method}_#{why_its_dangerous}". For example take ActiveRecord::Base#save and…

Original source here, by the way: https://www.ruby-forum.com/t/conventions-in-ruby-and-the-pri...

All of those things are "dangerous" in this sense.

It is arbitrary, but that's how Ruby works; there's a gray area shared understanding of concepts. The "principle of least surprise" is literally about Matz, and Matz alone. Yes, something may be surprising to you, or not, but it's not about you. This shared taste/understandings/whatever is just how convention works. (Or at least, it did when I was involved with Ruby; it's been a couple of years so I'm out of touch!)

Re: Ruby 3.0 Preview 1

#79
post #71

Earlier quoted context omitted.

No, metaprogramming is a stain on software engineering that all ecosystems are moving away from. Except Ruby.

What evidence do you have of "ecosystems" moving away from metaprogramming? Last I checked, it was just as popular in C++ as it's ever been, and a number of high-profile new languages (Rust, Elixir, Nim) have made it a major selling point.

Don't forget Clojure. Lisp wouldn't be lisp without meta programming/macros. Ruby has strong lisp roots and Ruby meta programming is what makes Rails so magical. Yes, we love magic in Ruby.

Re: Ruby 3.0 Preview 1

#80

Ruby is a really cool language but I'm dying for an update where features are removed .

Then Ruby isn't your language. There are a million ways to do everything by design. It's so you can make your code look pretty (or as they like to say "expressive") for whatever you interpretation of that means. It's one of the things that made me stop using it for most things.
Post reply on HN