News for hackers. Stuff that matters.
Re:Ruby 3.0.0 RC1 by raverbashing on Monday December 21, 2020 @10:12AM (#25495604)
Ruby might have some qualities but overall it's less polished than python

Just as a small example, Edit: .methods, "the Ruby equivalent of 'dir'" doesn't present the results as a sorted list

Also the optionality of parentheses sounds like a good idea but it actually makes things more confusing and less parseable

Re:Ruby 3.0.0 RC1 by jeltz on Monday December 21, 2020 @10:37AM (#25495844)
I would argue that is a good thing since it allows for performant access when you do not care about order. If you do not care about order you do usually not even have to allocate an array which means lower memory use. And how hard is it to write.

    Dir[path].sort
Ruby lacks polish in certain areas but this is not one. A d I would argue Python can be pretty tough in places too.
Re:Ruby 3.0.0 RC1 by raverbashing on Monday December 21, 2020 @11:27AM (#25496370)
Not that Dir, I mean as in .methods/.instance_methods (or dir(instance) in python )

I fixed it in my original comment

Re:Ruby 3.0.0 RC1 by jeltz on Tuesday December 22, 2020 @09:38AM (#25506625)
Then I understand your complaint even less. I almost never sort the output from methods and I do not think I have ever sorted the output from instance_methods during my over 10 years as a Ruby developer.
Re:Ruby 3.0.0 RC1 by raverbashing on Wednesday December 23, 2020 @05:19PM (#25522933)
Python orders it. And when you want to look up a method by name you do a binary search by fact of being a sorted list
Re:Ruby 3.0.0 RC1 by fomine3 on Wednesday December 23, 2020 @11:05PM (#25524955)
Anyway you can just .sort
Re:Ruby 3.0.0 RC1 by ben-schaaf on Monday December 21, 2020 @11:52AM (#25496677)
> .methods, "the Ruby equivalent of 'dir'" doesn't present the results as a sorted list

This seems like an odd complaint: Both languages use hash maps to look up methods/attributes, which aren't inherently sorted. Looking at the implementation `dir` in python does an explicit sort, which just seems like arbitrary behaviour.

Re:Ruby 3.0.0 RC1 by raverbashing on Monday December 21, 2020 @12:25PM (#25497072)
It's not an arbitrary behaviour if you want a well behaved result from it. Same with Python dictionary keys which used to have no intrinsic ordering.

Especially when dir() is more used in interactive applications (and sure, sometimes programatically like in plugin architectures, etc)

Re:Ruby 3.0.0 RC1 by dragonwriter on Monday December 21, 2020 @02:25PM (#25498397)
Because Ruby uses fairly deep metaprogramming much more, idiomatically, than does Python, while “dir() is more used in interactive applications” may be true, that does not imply that “#methods is more used in interactive applications”. And, anyhow, an interactive application that wants the information it asks for will quite often wan’t to impose an organization other than alphabetic ordering.