News for hackers. Stuff that matters.
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.