Live data from Hacker News

Ruby 3.4.0

ruby-lang.org

221–230 of 282 posts

Re: Ruby 3.4.0

#221
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.

> over any structure that exposes iteration

Taking OOP more seriously, this kind of thing should be implemented through inheritance, interfaces, mixins, etc. Even though I've got used to it, Python has these inconsistencies that sometimes it wants to be more OOP, sometimes it wants to be more FP.

Ruby has chosen OOP as its size, and implements nicely those functional operations as methods (same for Kotlin, for example). That makes easy for composing them:

# Sum of the square of even elements of a list, in Ruby

my_list.filter{|x| x % 2 == 0}.map{|x| x * 2}.sum

Python could do something like that, but we quickly fall in a parentheses hell:

# The same code, in Python

sum(map(lambda x: x * 2, filter(lambda x: x % 2 == 0, my_list)))

Languages that have chosen the FP path more seriously implement function composition. They could do the same way as Python, but composition makes it more readable:

# The same code, in Haskell

sum . map (^ 2) . filter (\x -> x `mod` 2 == 0) $ my_list

PS: I know that I it would be better to use comprehensions in both Python and Haskell, but these are general examples

Re: Ruby 3.4.0

#222
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…

Nice!

That's something that you could submit as a post here in HN

Re: Ruby 3.4.0

#223

I want to try Ruby since the news of Rails 8 came out, but it's been so difficult that I just gave up. Installing Ruby on Mac and Windows and actually getting the 3.3 version required for Rails 8 was a huge mission and test of patience because every installer defaulted to older versions of both Ruby and Rails even one month after the release. And yes, even Docker required tweaking to get the versions and I had issues…

On Mac, rbenv or asdf are both great. Also other commenters here have good suggestions. I never had problems with VSCode; curious what you ran into here.

Re: Ruby 3.4.0

#224

Earlier quoted context omitted.

[flagged]

Christmas Day is a traditional Ruby release day: https://en.wikipedia.org/wiki/History_of_Ruby#Table_of_versi...

Certainly! I bet it was part of a sort of "this is my Christmas present to all" sort of thing; and, as happens sometimes, little mistakes, like the need for the quick bugfix happen :)

Re: Ruby 3.4.0

#225

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…

That's completely normal for cathedral-style open source development. The FSF themselves required copyright assignment (not just a CLA) if you wanted to contribute to GNU projects (e.g. GCC) for many years; several GNU projects still do.

You only need to sign the CLA if you want to contribute to upstream, you can maintain your own fork if you want, and the code that is open source today will always be open source. Frankly I'd say Oracle is less likely to close it up in a scramble to try to monetise their open-source assets than smaller companies like Redis Labs - Oracle has plenty of products and makes their money from consulting rather than from selling code directly.

Re: Ruby 3.4.0

#226

I want to try Ruby since the news of Rails 8 came out, but it's been so difficult that I just gave up. Installing Ruby on Mac and Windows and actually getting the 3.3 version required for Rails 8 was a huge mission and test of patience because every installer defaulted to older versions of both Ruby and Rails even one month after the release. And yes, even Docker required tweaking to get the versions and I had issues…

Use rvm to install ruby. Ruby dev sucks on Windows, mac only.

It actually works quite well, if you use WSL.

Ruby itself works okay on bare-metal Windows, but virtually guaranteed any decent size Rails project will use some native gem that's a nightmare to get to build on Windows.

Re: Ruby 3.4.0

#227

Earlier quoted context omitted.

DHH is the issue, he means Rails is for one-person framework while he think static typing is only for enterprisey software.

DHH has no say in Ruby development. That being said, Matz also isn't a fan of static typing. Static type annotations exist in the form of RBS, but no one that matters in the Ruby eco-system is pushing static type annotations in .rb files themselves. Also, after seeing TypeScript, I'm very happy about that.

https://github.com/soutaro/rbs-inline

I myself am unsure where I stand on RBS. I wouldn't mind more use of it in my gem dependencies, but would probably not like it if it was enforced everywhere.

For now I'll stick with improving my test/spec-writing skills, and maybe some runtime type checking like https://literal.fun/

Re: Ruby 3.4.0

#228
post #39

Earlier quoted context omitted.

That has been the story of every dynamic language since forever, thankfully the whole AI focus has made JITs finally matter in CPython world as well. Personally I have learnt this lesson back in 2000's, in the age of AOLServer, Vignette, and our own Safelayer product. All based on Apache, IIS and Tcl. We were early adopters of .NET, when it was only available to MSFT Partners and never again, using scripting language…

>thankfully the whole AI focus has made JITs finally matter in CPython world as well. Isn't most of the work in Python AI projects done in C or C++ extensions anyway?

Yes, but not everyone loves to have dual stack development, I surely didn't, back in the Tcl days, eventually we ask ourselves for how long.

Re: Ruby 3.4.0

#229
post #114
post #39

Earlier quoted context omitted.

That has been the story of every dynamic language since forever, thankfully the whole AI focus has made JITs finally matter in CPython world as well. Personally I have learnt this lesson back in 2000's, in the age of AOLServer, Vignette, and our own Safelayer product. All based on Apache, IIS and Tcl. We were early adopters of .NET, when it was only available to MSFT Partners and never again, using scripting language…

What's a scripting language? Also I'm not sure for TCL ( https://news.ycombinator.com/item?id=24390937 claims it's had a bytecode compiler since around 2000) but the main python and Ruby implementations have compilers (compile to bytecode then interpret the bytecode). Apparently ruby got an optional (has to be enabled) jit compiler recently and python has an experimental jit in the last release (3.13).

https://en.m.wikipedia.org/wiki/Scripting_language

Re: Ruby 3.4.0

#230

I want to try Ruby since the news of Rails 8 came out, but it's been so difficult that I just gave up. Installing Ruby on Mac and Windows and actually getting the 3.3 version required for Rails 8 was a huge mission and test of patience because every installer defaulted to older versions of both Ruby and Rails even one month after the release. And yes, even Docker required tweaking to get the versions and I had issues…

Use asdf ( https://asdf-vm.com/ ) to manage your Ruby versions. You should be able to do $ asdf plugin add ruby $ asdf list all ruby (you'll see 3.4.1, the latest is available) $ asdf install ruby 3.4.1 And now you can use Ruby 3.4.1 with no issues. Follow that up with $ gem install bundler $ gem install rails $ rails new ...

Like psychoslave suggested, try out mise (https://github.com/jdx/mise). I used asdf for years, did the switch to mise and have never looked back for package management. It supports a huge number of languages and is performant.
Post reply on HN