Live data from Hacker News

Ruby 3.4.0

ruby-lang.org

211–220 of 282 posts

Re: Ruby 3.4.0

#211

Earlier quoted context omitted.

Using the same language to write your frontend and backend is desirable for many people / teams.

but why does that language have to be one as braindead as javascript. path-dependency is the root of all evil.

Because nobody championed another language for the browser.

Good news is we have WASM now, so you can write backend and frontend code in basically whatever language you want.

Re: Ruby 3.4.0

#212

Earlier quoted context omitted.

It's the language with the highest ratio of (useful work / LOC), so it's the least verbose language. This makes it very suitable to write and understand complex scripts, because the reduced boilerplate means less cognitive overhead for the programmer. As a result, experienced programmers can be extremely productive with it. The well-known Rails framework uses this to great effect, however, some people argue that the…

I see some people saying that Ruby is too much "magic", while what is magic is Rails. Ruby itself can have its high useful work / LoC ratio thanks to its syntax. For example, you can spawn a thread with: thread = Thread.new do # thread code end ... thread.join In this example we can see that it's not magic, only concise. I wrote more about it here: https://news.ycombinator.com/item?id=40763640

Creating a new thread is equally simple in Java:

    var thread = new Thread(() -> {
      // Thread code
    });
    thread.start();
    // ...
    thread.join();

Re: Ruby 3.4.0

#213

Earlier quoted context omitted.

I see some people saying that Ruby is too much "magic", while what is magic is Rails. Ruby itself can have its high useful work / LoC ratio thanks to its syntax. For example, you can spawn a thread with: thread = Thread.new do # thread code end ... thread.join In this example we can see that it's not magic, only concise. I wrote more about it here: https://news.ycombinator.com/item?id=40763640

Creating a new thread is equally simple in Java: var thread = new Thread(() -> { // Thread code }); thread.start(); // ... thread.join();

Yes, but it's a good example of how Java is about twice as verbose to do the same work. The Ruby version of that can be written as simply:

Thread.new{ ... thread code ...}.join

The extra verboseness quickly adds up if every statement takes twice as much code.

Re: Ruby 3.4.0

#214

Every year-end, I update my Rails app. Lately, it's been stable, and the updates just improve performance, so it's gotten easier.

I started at a company 3 years ago that was on Rails 5.1. After 3 years on and off work I've managed to get it to Rails 6.1. The process is such an incredible nightmare on a large app. Currently stuck on trying to get Ruby 3 working.

Curious what specifically you’re running into?

Re: Ruby 3.4.0

#215
post #44
post #5

‘it’ is a welcome addition!

Truly is, much nicer than that lonely `_1`

I'd have thought allowing _ as a synonym for _1 would have been more aesthetically consistent. That's the path I went with when designing my CL #λ reader macro, personally.

Re: Ruby 3.4.0

#217
post #36

Earlier quoted context omitted.

Ruby has the nicest object-oriented design (everything is an object) outside of smalltalk (IMHO). In contrast to the mess that is Python. For instance, in Ruby it is natural that each or map are methods of Array or Hash rather than global functions which receive an Array or Hash argument. This goes as far as having the not operator '!' as a method on booleans: false.! == true Once you have understood it, it is a very…

Everything is an object in Python, as well. Stuff like map() is generic iteration, over any structure that exposes iteration. When it's a member function, it means that every collection has to implement map itself basically. When it's separate, the collections only need to provide the interface needed to iterate over it, and the generic map() will just use that.

Still looks much less beautiful. Python feels to me like it can't make up its mind.

Re: Ruby 3.4.0

#218
post #85

Earlier quoted context omitted.

huh. I'm not sure if I understood you right, do you script and configure those in ruby, or have you written them in ruby from scratch? Are the sources available to read/learn from?

They're written in Ruby from scratch. Some are available, e.g. the window manager is here: https://github.com/vidarh/rubywm Beware that one of the joys of writing these for my own use is that I've only added the features I use, and fixed bugs that matter to me, and "clean enough to be readable for me" is very different from best practice for a bigger project. I'm slowly extracting the things I'm willing to more gener…

wow, thank you for publishing this!

Re: Ruby 3.4.0

#219

Earlier quoted context omitted.

No wait, I know Oracle has a bad rep which is deserved, but TruffleRuby and GraalVM is truly open-source, not open-core. They actually did something great this time. Someone pointed this out https://news.ycombinator.com/item?id=42323293

> You will need to sign the Oracle Contributor Agreement (using an online form) for us to able to review and merge your work. Read my lips: N. O. Read the CLA. This is a trap, do not get yourself or your company caught in it. It is open-source for now, until it gets enough traction. Then the rug will be pulled, the code will be relicensed as well as any further development or contributions. This is insane , I cannot…

Thank you. Never trust Oracle, ever. They will betray you.

Re: Ruby 3.4.0

#220

Earlier quoted context omitted.

I see some people saying that Ruby is too much "magic", while what is magic is Rails. Ruby itself can have its high useful work / LoC ratio thanks to its syntax. For example, you can spawn a thread with: thread = Thread.new do # thread code end ... thread.join In this example we can see that it's not magic, only concise. I wrote more about it here: https://news.ycombinator.com/item?id=40763640

Creating a new thread is equally simple in Java: var thread = new Thread(() -> { // Thread code }); thread.start(); // ... thread.join();

Fair. I must admit that I'm not aware of the recent features of Java. Last time I really needed it was the time that we needed to instance an anonymous class for callbacks. I still find the block syntax in Ruby cleaner though.

Kotlin is another language that has this Ruby-style blocks for callbacks.

Post reply on HN