News for hackers. Stuff that matters.
Re:Rhombus Language by cies on Tuesday March 18, 2025 @05:08AM (#43397107)
I found Kotlin a "typed Ruby" (I found Ruby a "sane Perl").

Rust seems pretty nice to work with (good DX) in it's domain: close to the metal programs were every tick counts. The main DX issue with it would be compile times.

Go's awful to me from a DX perspective as it is lacks proper error handling. Compile times are great though.

Maybe OCaml is a good fit for me (and you!). Fast compile times and good error handling.

TypeScript suffers too much from being a JS superset. JS has horrendous DX imho.

Re:Rhombus Language by dominicrose on Tuesday March 18, 2025 @05:49AM (#43397419)
Interesting. I learned Ruby a long time ago because a Perl expert told me Ruby was getting good. I like Typescript because it's really easy to read and maintain without breaking anything. But you can't do this: `next x.map { _1 + 3 }.sum if sth`. I guess I should give Kotlin a try then.
Re:Rhombus Language by pmontra on Tuesday March 18, 2025 @08:24AM (#43398566)
After 20 years of Ruby I didn't know (or didn't remember) that next can have an argument. I looked it up. Thanks.

BTW, I never liked the _N arguments. Too cryptic. They make me stop and think on details instead of just read the code and concentrate on the important stuff.

  x.map {¦n¦ n + 3}.sum
is immediately clear but I guess that it's very subjective.
Re:Rhombus Language by phiiiillll on Tuesday March 18, 2025 @11:48AM (#43400863)
In 3.4 you can now do

  x.map { it + 3 }.sum 
which I'm still getting used to
Re:Rhombus Language by pmontra on Tuesday March 18, 2025 @04:35PM (#43404734)
Even the same customer has projects with Ruby ranging from 2.7 to 3.4 so I'm using the oldest possible syntax. The changes in keyword args hit hard some projects. Luckily not the one I'm working on most of my time.
Re:Rhombus Language by cies on Wednesday March 19, 2025 @04:50AM (#43409577)
You also find `it` in Kotlin.
Re:Rhombus Language by dominicrose on Tuesday March 18, 2025 @12:42PM (#43401506)
Such details are so subjective even a same person could change his/her mind about it and change it back later... I think they did a safe job of adding this _N feature though, since it's not allowed all the time. It felt like a missing feature because you could do map(&:to_i) but needed a parameter for something simple like map { |x| x == 5 }.

The `next` keyword is interesting in Ruby. It can be used as an explicit return for blocks. In javascript, for comparison, there is a `continue` for standard loops, but non-standard blocks don't exist so they are functions and require the use of the return keyword (except for single-instruction arrow functions). And implicit returns or nexts simply don't exist in js.

Re:Rhombus Language by agent281 on Tuesday March 18, 2025 @11:12AM (#43400426)
Did you ever see Crystal? It's more or less a typed Ruby. I've heard that you can port some code directly.

https://crystal-lang.org/

Re:Rhombus Language by cies on Wednesday March 19, 2025 @04:48AM (#43409567)
YesI have. But I need to get work done so I rather use a language with a larger ecosystem.

Also, I've come to prefer more FP.