Closed dwarring closed 6 years ago
Is this good? For big hashes it will steal time. Anyway hashes are not ordered by definition. I would endorse that .gist method should short keys somehow but not .perl
Note that, in the latest Rakudo, hashes appear to be ordered.
% perl6-m --version This is perl6 version 2015.04-204-ga040b1a built on MoarVM version 2015.04-62-g052aca0 % perl6-m -e'say { :a(10), :b(20), :c(30) }.perl' {:a(10), :b(20), :c(30)} % % perl6-m -e'say { :a(10), :b(20), :c(30) }.perl' {:a(10), :b(20), :c(30)}
They are sorted - see resolved ticket https://rt.perl.org/Ticket/Display.html?id=124148
Hashes are no longer sorted
S02 currently has no opinion on whether the
.perl
method should sort hash entries or leave them in random order. Rakudo implementations currently randomize entries, e.g.:This should maybe be explicitly stated.
I'm in the habit of using
.perl
to dump and view data. I'd find sorted entries easier to work with, in terms of viewing, grepping etc.