Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

Baggy/Setty .Str/.gist/.perl needs to guarantee order, like Map/Hash do #6218

Open p6rt opened 7 years ago

p6rt commented 7 years ago

Migrated from rt.perl.org#131244 (status was 'new')

Searchable as RT131244$

p6rt commented 7 years ago

From @zoffixznet

https://irclog.perlgeek.de/perl6-dev/2017-05-02#i_14519628

* TimToady notes that .perl and .gist do guarantee sorted order 16​:02 Zoffix s​: bag(), 'perl', \() 16​:02 SourceBaby Zoffix, Sauce is at https://github.com/rakudo/rakudo/blob/08a8075/src/core/Baggy.pm#L375 16​:03 Zoffix Don't look like it 16​:03 TimToady they're supposed to 16​:03 Zoffix And if it does, then .Stringy also does, 'cause they're using the same Baggy!LISTIFY method 16​:04 TimToady you can always iterate a hash yourself if you really want unordered 16​:04 sets and bags should follow the same policy 16​:05 Zoffix So Hash.Str is guaranteed to be ordered? 16​:05 Oh yeah​: multi method Str(Map​:D​:) { self.sort.join("\n") } 16​:06 m​: use nqp; dd nqp​::getattr(Map.new(\<a 42>), Map, '$!storage').^name 16​:06 camelia rakudo-moar 08a807​: OUTPUT​: «"BOOTHash"␤» 16​:07 Zoffix And Baggy takes nqp​::iterator() of BOOTHash and just loops over it... I'm guessing that's unordered 16​:07 timotimo yeah, that's unordered