Skip Menu |
Report information
Id: 115758
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] .max methods on hashes and pairs seem to ignore their :by argument in Rakudo
Date: Fri, 16 Nov 2012 12:25:08 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 923b
<masak> r: say { 0 => 1, 1 => 0 }.max(:by(*.value)) <p6eval> rakudo a41a48: OUTPUT«"1" => 0␤» <masak> looks like a bug to me. * masak submits rakudobug <masak> grondilu++ # discoverer <moritz> r: say { 0 => 1, 1 => 0 }.pairs.max(:by(*.value)) <p6eval> rakudo a41a48: OUTPUT«"1" => 0␤» <moritz> r: say (0 => 1, 1 => 0).max(:by(*.value)) <p6eval> rakudo a41a48: OUTPUT«1 => 0␤» <masak> r: say max :by(*.value), { 0 => 1, 1 => 0 }.list <p6eval> rakudo a41a48: OUTPUT«"0" => 1␤» <masak> I think a number of method forms may simply be missing their :by parameter. <moritz> r: say List.can('max') <p6eval> rakudo a41a48: OUTPUT«max␤» <moritz> r: say List.can('max')[0].signature.perl <p6eval> rakudo a41a48: OUTPUT«:(: $by = { ... }, Mu *%_)␤» <moritz> r: say Parcel.can('max')[0].signature.perl <p6eval> rakudo a41a48: OUTPUT«:(: $by = { ... }, Mu *%_)␤» <moritz> seems it should work <masak> weird.
Download (untitled) / with headers
text/plain 1.9k
On Fri Nov 16 03:25:43 2012, masak wrote: Show quoted text
> <masak> r: say { 0 => 1, 1 => 0 }.max(:by(*.value)) > <p6eval> rakudo a41a48: OUTPUT«"1" => 0␤» > <masak> looks like a bug to me. > * masak submits rakudobug > <masak> grondilu++ # discoverer > <moritz> r: say { 0 => 1, 1 => 0 }.pairs.max(:by(*.value)) > <p6eval> rakudo a41a48: OUTPUT«"1" => 0␤» > <moritz> r: say (0 => 1, 1 => 0).max(:by(*.value)) > <p6eval> rakudo a41a48: OUTPUT«1 => 0␤» > <masak> r: say max :by(*.value), { 0 => 1, 1 => 0 }.list > <p6eval> rakudo a41a48: OUTPUT«"0" => 1␤» > <masak> I think a number of method forms may simply be missing their > :by parameter. > <moritz> r: say List.can('max') > <p6eval> rakudo a41a48: OUTPUT«max␤» > <moritz> r: say List.can('max')[0].signature.perl > <p6eval> rakudo a41a48: OUTPUT«:(: $by = { ... }, Mu *%_)␤» > <moritz> r: say Parcel.can('max')[0].signature.perl > <p6eval> rakudo a41a48: OUTPUT«:(: $by = { ... }, Mu *%_)␤» > <moritz> seems it should work > <masak> weird.
Some notes from today: 18:18 MasterDuke r: say (0 => 1, 1 => 0).max(:by(*.value)) 18:18 camelia rakudo-moar 68443f, rakudo-jvm cd19db: OUTPUT«1 => 0␤» 18:18 MasterDuke r: say (0 => 1, 1 => 0).max(*.value) 18:18 camelia rakudo-moar 68443f, rakudo-jvm cd19db: OUTPUT«0 => 1␤» 18:20 MasterDuke r: say List.can("max")[0].signature.perl 18:20 camelia rakudo-moar 68443f, rakudo-jvm cd19db: OUTPUT«:($: | is raw)␤» 18:20 MasterDuke i was looking at RT #115758, but it's pretty old 18:20 synopsebot6 Link: https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=115758 18:21 MasterDuke r: say max :by(*.value), { 0 => 1, 1 => 0 } 18:21 camelia rakudo-moar 68443f, rakudo-jvm cd19db: OUTPUT«0 => 1␤» 19:55 MasterDuke masak, moritz: do you think RT #115758 is still valid? 20:14 masak MasterDuke: yes, I think it's still valid. unless something has happened that's outside of the scope of what I'm reading in that ticket. but I know of no such thing.
Download (untitled) / with headers
text/plain 2.9k
On Tue Aug 30 20:00:31 2016, ddgreen@gmail.com wrote: Show quoted text
> On Fri Nov 16 03:25:43 2012, masak wrote:
> > <masak> r: say { 0 => 1, 1 => 0 }.max(:by(*.value)) > > <p6eval> rakudo a41a48: OUTPUT«"1" => 0␤» > > <masak> looks like a bug to me. > > * masak submits rakudobug > > <masak> grondilu++ # discoverer > > <moritz> r: say { 0 => 1, 1 => 0 }.pairs.max(:by(*.value)) > > <p6eval> rakudo a41a48: OUTPUT«"1" => 0␤» > > <moritz> r: say (0 => 1, 1 => 0).max(:by(*.value)) > > <p6eval> rakudo a41a48: OUTPUT«1 => 0␤» > > <masak> r: say max :by(*.value), { 0 => 1, 1 => 0 }.list > > <p6eval> rakudo a41a48: OUTPUT«"0" => 1␤» > > <masak> I think a number of method forms may simply be missing their > > :by parameter. > > <moritz> r: say List.can('max') > > <p6eval> rakudo a41a48: OUTPUT«max␤» > > <moritz> r: say List.can('max')[0].signature.perl > > <p6eval> rakudo a41a48: OUTPUT«:(: $by = { ... }, Mu *%_)␤» > > <moritz> r: say Parcel.can('max')[0].signature.perl > > <p6eval> rakudo a41a48: OUTPUT«:(: $by = { ... }, Mu *%_)␤» > > <moritz> seems it should work > > <masak> weird.
> > > Some notes from today: > > 18:18 MasterDuke r: say (0 => 1, 1 => 0).max(:by(*.value)) > 18:18 camelia rakudo-moar 68443f, rakudo-jvm cd19db: > OUTPUT«1 => 0␤» > 18:18 MasterDuke r: say (0 => 1, 1 => 0).max(*.value) > 18:18 camelia rakudo-moar 68443f, rakudo-jvm cd19db: > OUTPUT«0 => 1␤» > 18:20 MasterDuke r: say List.can("max")[0].signature.perl > 18:20 camelia rakudo-moar 68443f, rakudo-jvm cd19db: > OUTPUT«:($: | is raw)␤» > 18:20 MasterDuke i was looking at RT #115758, but it's pretty > old > 18:20 synopsebot6 Link: https://rt.perl.org/rt3//Publ > ic/Bug/Display.html?id=115758 > 18:21 MasterDuke r: say max :by(*.value), { 0 => 1, 1 => 0 } > 18:21 camelia rakudo-moar 68443f, rakudo-jvm cd19db: > OUTPUT«0 => 1␤» > > 19:55 MasterDuke masak, moritz: do you think RT #115758 is > still valid? > > 20:14 masak MasterDuke: yes, I think it's still valid. unless > something has happened that's outside of the scope of what I'm reading > in that ticket. but I know of no such thing.
Commentary from jnthn: http://irclog.perlgeek.de/perl6-dev/2016-08-31#i_13127809 Some of the most relevant portions quoted below. <jnthn> I'm curious if any other non-max methods take :by though. I'd thought we were doing that on the sub forms to not confuse the transform with a list value <jnthn> But on the method forms there's no such ambiguity <MasterDuke> git grep 'method.*:by' (or git grep 'method.*:&by') <MasterDuke> returns no results <jnthn> Suggests "no" then :) <jnthn> In which case the ticket is kinda asking us to add them *everywhere* since it'd be odd to do it just for max. :) <jnthn> But I'm not really that inclined to. <jnthn> Yeah, so far as I recall we went that way on the subs, and positional for the methods, and it was a deliberate choice Based on the above conversation I'm going to recommend this be closed as not a bug.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org