It feels like RBS is for library writers, so that they can ship type information to help the consumers of their library. It’s not really aimed at the consumers themselves — the long tail of casual Ruby hackers like me. If RBS was for end users, adding types inline with the source code would make more sense compared to the RBS approach: keeping the source file and typedef file in sync. That might actually be a pretty…
Ruby 3.0 Preview 1
121–130 of 207 posts
Re: Ruby 3.0 Preview 1
#122>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…
I consider myself a sensible developer, but even I’ve had some childish moments with Ruby: doing something I thought was clever and productive but which really just made my code inscrutable and unmaintainable...
...by other people. The flip side is I can just about figure out what I was trying to do when I read my own code: enough so that I still always use Ruby for personal projects.
Ruby is just too much fun and critically, to date, it’s the only language where I can write a page of code at the same speed I am thinking. It also usually executes first time without any errors, which is a joyous thing.
I am not claiming to be some kind of 10x uber hacker. Ruby just happens to be an incredibly wonderful language for thinking aloud with code.
Re: Ruby 3.0 Preview 1
#123This is all great stuff. I’m rather meh on RBS, mainly because separating types from code is less than ideal but I like the potential here. But the right hand assignment operator. What on earth. Nobody asked for that and nobody wants it. Why.
begin
#... do something
rescue StandardError => ex
#... handle exception
end
The ex here can be any assignment expression, it's not just a lexical variable. So you could already do this: class Guru
def meditate=(exception)
puts "caught #{exception.inspect}"
end
end
# later ...
rescue OutOfCheeseError => Guru.new.meditate
i.e. creating a nice opportunity for passing error handlers around as an argument; or, this worrying idea: rescue TransactionError => Thread.current[:exception]
and now I'm afraid you can do this: Cat = Struct.new(:name) do
class Cat.adoptRe: Ruby 3.0 Preview 1
#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…
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 already been run and .count if it hasn't.
Re: Ruby 3.0 Preview 1
#125Question: 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.
Re: Ruby 3.0 Preview 1
#126I 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.
Re: Ruby 3.0 Preview 1
#127Re: Ruby 3.0 Preview 1
#128I'm not a fan of rightward assignment because I don't see much value and now the => operator has even more meanings.
I'm not a fan of endless methods because how lazy do you have to be to not want to type 'end'? My editor does it for me automatically. Now there is even more parsing.
Re: Ruby 3.0 Preview 1
#129Earlier quoted context omitted.
But that's what I love about Ruby! There's so many great ways to express logic, making Ruby a language that really rewards exploration. Of course, when working with a team on a production application, you'd set up standards everyone can agree on and understand with rubocop or prettier-rb (which I loathe and will not touch with a 10-foot long pole for my personal projects). That's also great for onboarding newcomers -…
> you'd set up standards everyone can agree on and understand with rubocop or prettier-rb Things like that just often lead to bikeshedding. And then worse, powerful voices may approve ideas that work for them and not everyone else, or even more worse crippling a language to be too safe or bland to be truly useful. I got into an argument a couple weeks ago whether an unprotected eval() in python should make it's way i…
Re: Ruby 3.0 Preview 1
#130>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…