Live data from Hacker News

Ruby 3.0 Preview 1

ruby-lang.org

181–190 of 207 posts

Re: Ruby 3.0 Preview 1

#181

Earlier quoted context omitted.

Latest talk about scheduler: https://www.youtube.com/watch?v=Y29SSOS4UOc Recent summary of scheduler, a little bit out of date (changes to interface): https://www.codeotaku.com/journal/2020-04/ruby-concurrency-f...

I will watch your presentation but if u could put my mind at ease: Is the scheduler a kind of event loop (like Node) implemented in Ruby? So if I wanted to use this thing everything I write would have to be callback based ?

Yes, it lets you implement event loop for Ruby. We use fibers to avoid callback hell and avoid rewriting existing code. This is covered in my talk here: https://www.youtube.com/watch?v=qKQcUDEo-ZI

Re: Ruby 3.0 Preview 1

#182
post #156

Earlier quoted context omitted.

The programs aren't doing the same things. The Ruby one seems to buffer the matches into a huge string then print. Don't know how different it would be but better to compare apples.

IO.foreach without a block returns an enumerator.

You may be right. This version:

    IO.foreach('logs1.txt') {|x| puts x if /\b\w{15}\b/.match? x }
... runs in 1.3 secs, ie. same time as Python. Still, I exepcted Ruby 3x3 to beat standard Python.

Re: Ruby 3.0 Preview 1

#183
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!

Now they just need to make it defless too.

Re: Ruby 3.0 Preview 1

#184

Earlier quoted context omitted.

I will watch your presentation but if u could put my mind at ease: Is the scheduler a kind of event loop (like Node) implemented in Ruby? So if I wanted to use this thing everything I write would have to be callback based ?

Yes, it lets you implement event loop for Ruby. We use fibers to avoid callback hell and avoid rewriting existing code. This is covered in my talk here: https://www.youtube.com/watch?v=qKQcUDEo-ZI

Hope it's alright to ask you a personal question: How did you get to the point you can work with Ruby internals so well? Did you come from a C background or had some backgrounds with VM's / programming language design?

Re: Ruby 3.0 Preview 1

#185
Not a Rubyist. Would Ractor allow one process to use up all CPUs while avoiding copying objects? Can I build shareable objects with immutable lists and maps right now?

Re: Ruby 3.0 Preview 1

#186

I left Ruby because the performance and security weren't improving and the community was slowly dying. I delved into Go before that got flooded with newbs, then looked at Crystal and Pony, before settling on Rust and Haskell for most things.

How do you choose all this? I haven't been able to make a single decision for what language to use at work for the past 15 years. I thought wouldn't touch C#, ruby, delphi, kotlin and python but it all happened because someone was paying.

> I haven't been able to make a single decision for what language to use at work for the past 15 years.

Hello PHP.

Re: Ruby 3.0 Preview 1

#187
post #124

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

The thing that most annoyed me about Rails (not Ruby) was that users.size users.length users.count are all valid, all useful, all have different meanings, are all present in plain Ruby but with different meanings, and contain absolutely no information about what they do. For reference, .length loads everything and gets the length of the collection, .count runs a SQL COUNT query, and .size uses length if the query has…

Ugh yes I don't like this as well. Even if they're all useful, I'd do it with one method that accepts some optional arguments, this is unnecessarily confusing.

Re: Ruby 3.0 Preview 1

#188

Not a Rubyist. Would Ractor allow one process to use up all CPUs while avoiding copying objects? Can I build shareable objects with immutable lists and maps right now?

Yes, Ractor allows you to share fully immutable objects. So you can freeze an array or hash and share it as long as it doesn’t contain any references to mutable objects.

Re: Ruby 3.0 Preview 1

#189

Didn’t see it linked in the preview announcement, here’s the RBS syntax guide: https://github.com/ruby/rbs/blob/master/docs/syntax.md Glanced at it from my phone but it looks good! I’m looking forward to seeing it in RubyMine. Still sad that we can’t write these in .rb files but I wonder if the plan is to go the other way, eventually permit typed code in .rbs? Does anyone know what the story will be with third-party…

It seems like the intent is for RBS to be auto generated from other tooling. Sorbet for example lets you write inline type definitions and is planned to fully integrate with RBS.

The other good thing about RBS being in separate files is it can be integrated into a library without breaking compatibility with older Ruby versions.

Re: Ruby 3.0 Preview 1

#190
I wish I had kept maintaining my port of Ruby to the IBM BLue Gene/L, "Blue Ruby". It scaled to millions of cores with MPI. Had distributed versions of familiar Ruby data types. There was no fork() - restriction of the BGL kernel not supporting it - only green threads - making parallel operations truly parallel with independent Ruby VMs and passing code to data instead of data to code.
Post reply on HN