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

Error when trying to take the middle of 1-element thing with */2 in Rakudo #3462

Closed
p6rt opened this issue Jul 28, 2014 · 4 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 28, 2014

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

Searchable as RT122423$

@p6rt
Copy link
Author

p6rt commented Jul 28, 2014

From @masak

<Ven> m​: say (1.11)[*/2]
<camelia> rakudo-moar 319a78​: OUTPUT«Index out of range. Is​: 0.5,
should be in 0..0 [...]
<Ven> "should be 0..0" ?
<Timbus> not much wiggle room there
<masak> yes, that error shouldn't happen.
<masak> since if it didn't, the 0.5 would be successfully rounded down to 0.
* masak submits rakudobug
<Ven> masak​: you don't think that should be an error ?
<masak> I think it shouldn't be an error.
<masak> fractional indices don't exist, 0.5 gets rounded down to 0,
which is a legal index.
<masak> more philosophically, you're doing */2 because you want the
middle index, which should work for a 1-element thing.
<Timbus> ya its common to.. ^ that
<Ven> meh.
<masak> this is a case of "validation should happen *after* dwimming
the parameter".

@p6rt
Copy link
Author

p6rt commented Jul 29, 2014

From @perlpilot

On Mon Jul 28 03​:46​:48 2014, masak wrote​:

<Ven> m​: say (1.11)[*/2]
<camelia> rakudo-moar 319a78​: OUTPUT«Index out of range. Is​: 0.5,
should be in 0..0 [...]
<Ven> "should be 0..0" ?
<Timbus> not much wiggle room there
<masak> yes, that error shouldn't happen.
<masak> since if it didn't, the 0.5 would be successfully rounded down to 0.
* masak submits rakudobug
<Ven> masak​: you don't think that should be an error ?
<masak> I think it shouldn't be an error.
<masak> fractional indices don't exist, 0.5 gets rounded down to 0,
which is a legal index.
<masak> more philosophically, you're doing */2 because you want the
middle index, which should work for a 1-element thing.
<Timbus> ya its common to.. ^ that
<Ven> meh.
<masak> this is a case of "validation should happen *after* dwimming
the parameter".

Fixed in 6be102830a4a2c1c329c963f67ca06a24a69e8f4
-Scott

@p6rt
Copy link
Author

p6rt commented Jul 29, 2014

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

@p6rt
Copy link
Author

p6rt commented Jul 29, 2014

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

@p6rt p6rt closed this as completed Jul 29, 2014
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant