Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.max should warn if it sees useless :by parameter ( .max(:by(*.value)) ) #5987

Closed
p6rt opened this issue Jan 5, 2017 · 5 comments
Closed
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Jan 5, 2017

Migrated from rt.perl.org#130517 (status was 'resolved')

Searchable as RT130517$

@p6rt
Copy link
Author

p6rt commented Jan 5, 2017

From @AlexDaniel

Code​:
say { 0 => 1, 1 => 0 }.max(​:by(*.value))

Result​:
1 => 0

Code​:
say { 0 => 1, 1 => 0 }.max(*.value)

Result​:
0 => 1

I think :by(…) is something people commonly try (somebody did this on camelia, and I remember doing this myself), so it would be great if it could warn the user.

@p6rt
Copy link
Author

p6rt commented Apr 26, 2017

From @zoffixznet

On Thu, 05 Jan 2017 07​:59​:29 -0800, alex.jakimenko@​gmail.com wrote​:

Code​:
say { 0 => 1, 1 => 0 }.max(​:by(*.value))

Result​:
1 => 0

Code​:
say { 0 => 1, 1 => 0 }.max(*.value)

Result​:
0 => 1

I think :by(…) is something people commonly try (somebody did this on
camelia, and I remember doing this myself), so it would be great if it
could warn the user.

So why do people try it, anyway? Why that specific named param?

I rather not litter the code with heuristics to catch arbitrary named params.

@p6rt
Copy link
Author

p6rt commented Apr 26, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 17, 2017

From @zoffixznet

On Wed, 26 Apr 2017 06​:31​:06 -0700, cpan@​zoffix.com wrote​:

On Thu, 05 Jan 2017 07​:59​:29 -0800, alex.jakimenko@​gmail.com wrote​:

Code​:
say { 0 => 1, 1 => 0 }.max(​:by(*.value))

Result​:
1 => 0

Code​:
say { 0 => 1, 1 => 0 }.max(*.value)

Result​:
0 => 1

I think :by(…) is something people commonly try (somebody did this on
camelia, and I remember doing this myself), so it would be great if
it
could warn the user.

So why do people try it, anyway? Why that specific named param?

I rather not litter the code with heuristics to catch arbitrary named
params.

I see our docs call the arg `&by` for this routine. I clarified[^1][^2] in
the docs that this is a positional and not a named arg and IMO we should
not add any changes to Rakudo's source for this ticket.

[^1] Raku/doc@2f8f417
[^2] Raku/doc@67ab9c1

@p6rt p6rt closed this as completed May 17, 2017
@p6rt
Copy link
Author

p6rt commented May 17, 2017

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt added the LTA Less Than Awesome; typically an error message that could be better label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant