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

'* + 2' curries, but '* min 2' doesn't # POL bug #3502

Closed
p6rt opened this issue Sep 5, 2014 · 5 comments
Closed

'* + 2' curries, but '* min 2' doesn't # POL bug #3502

p6rt opened this issue Sep 5, 2014 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Sep 5, 2014

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

Searchable as RT122708$

@p6rt
Copy link
Author

p6rt commented Sep 5, 2014

From @dwarring

This issues was raised on SO
http://stackoverflow.com/questions/25669107/when-can-i-use-the-whatever-star and has been discussed on #perl6 IRC.

The conclusion is that this behavior, although to spec, is a POL (Principle of Least Astonishment) bug.

[07​:55] * dwarring looking at http://stackoverflow.com/questions/25669107/when-can-i-use-the-whatever-star
[07​:56] <dwarring> '* + 2' curries, but '* min 2' doesn't
[07​:56] <colomon> really?
[07​:57] <dwarring> m​: say * + 2
[07​:57] <+camelia> rakudo-moar fd9238​: OUTPUT«WhateverCode.new()␤»
[07​:57] <dwarring> m​: say * min 2
[07​:57] <+camelia> rakudo-moar fd9238​: OUTPUT«2␤»
[07​:57] <dwarring> yep
[07​:57] <FROGGS> m​: say * max 2
[07​:57] <+camelia> rakudo-moar fd9238​: OUTPUT«*␤»
[07​:57] <dwarring> say min 10, 12, 42, 3
[07​:57] <FROGGS> so it becomes Inf-ish?
[07​:57] <dwarring> say 3 min 4
[07​:58] <dwarring> m​: say 3 min 4
[07​:58] <+camelia> rakudo-moar fd9238​: OUTPUT«3␤»
[07​:58] <colomon> where's that list of non-WhateverCode operators?
[07​:58] <dwarring> min can be used as an infix
[07​:59] <colomon> n​: say * min 2
[07​:59] <+camelia> niecza v24-109-g48a8de3​: OUTPUT«{ ... }␤»
[07​:59] <dwarring> but isn't currying as such
[07​:59] <colomon> I think this might be a rakudobug?
[07​:59] <FROGGS> perhaps it checks for an existing sub before it checks for infixes?
[07​:59] <FROGGS> (just guessing)
[07​:59] <colomon> p6​: say (1..20).map(* min 3)
[08​:00] <dwarring> something to do with the signature (also guessing)
[08​:00] <+camelia> rakudo-jvm fd9238​: OUTPUT«(timeout)»
[08​:00] <+camelia> ..rakudo-parrot fd9238​: OUTPUT«No such method 'count' for invocant of type 'Int'␤ in method reify at gen/parrot/CORE.setting​:7892␤ in method reify at gen/parrot/CORE.setting​:7808␤ in method reify at gen/parrot/CORE.setting​:7808␤ in method reify at gen/parrot/CORE.setting​:7…»
[08​:00] <+camelia> ..rakudo-moar fd9238​: OUTPUT«No such method 'count' for invocant of type 'Int'␤ in method reify at src/gen/m-CORE.setting​:7943␤ in method reify at src/gen/m-CORE.setting​:7855␤ in method reify at src/gen/m-CORE.setting​:7855␤ in method reify at src/gen/m-CORE.setting​:7956␤…»
[08​:00] <+camelia> ..niecza v24-109-g48a8de3​: OUTPUT«1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3␤»
[08​:00] <colomon> http://perlcabal.org/syn/S02.html#Operators_with_idiosyncratic_Whatever
[08​:01] <colomon> I don't see any reason this list should also include min / max?
[08​:01] * TimToady sees no signatures with * offhand
[08​:02] <lizmat> m​: say (1..20).map​: { $_ min 3 } # works ok
[08​:02] <+camelia> rakudo-moar fd9238​: OUTPUT«1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3␤»
[08​:04] * grondilu notices that Digest still does not pass all tests and looks into it
...
[08​:06] <lizmat> well, at any case, that error for say (1..20).map(* min 3) is LTA
...
[08​:09] <dwarring> ^^ does this deserve a ticket (* min 2 not currying)
[08​:09] <colomon> I guess (reading over it again) the spec question is, should infix​:<min> be "Whatever-aware"?
[08​:09] <colomon> I can't think of any reason it should, but maybe there's something I'm missing here.
[08​:10] <grondilu> retupmoca++
[08​:13] <TimToady> I'd call it a POLA bug
[08​:13] <TimToady> something is treating min as if it were a range
[08​:13] <lizmat> POLA?
[08​:14] <TimToady> just like POLS, only differnet
[08​:14] <colomon> POLS?
[08​:14] <TimToady> s/Surprise/Astonishment/

@p6rt
Copy link
Author

p6rt commented Sep 6, 2014

From @dwarring

Fudged tests added to S02-types/whatever.t
Neither of 'min' and 'max' are currying. I've added tests for both of these.
On Fri Sep 05 13​:33​:39 2014, david.warring wrote​:

This issues was raised on SO
http://stackoverflow.com/questions/25669107/when-can-i-use-the-
whatever-star and has been discussed on #perl6 IRC.

The conclusion is that this behavior, although to spec, is a POL
(Principle of Least Astonishment) bug.

[07​:55] * dwarring looking at
http://stackoverflow.com/questions/25669107/when-can-i-use-the-
whatever-star
[07​:56] <dwarring> '* + 2' curries, but '* min 2' doesn't
[07​:56] <colomon> really?
[07​:57] <dwarring> m​: say * + 2
[07​:57] <+camelia> rakudo-moar fd9238​: OUTPUT«WhateverCode.new()␤»
[07​:57] <dwarring> m​: say * min 2
[07​:57] <+camelia> rakudo-moar fd9238​: OUTPUT«2␤»
[07​:57] <dwarring> yep
[07​:57] <FROGGS> m​: say * max 2
[07​:57] <+camelia> rakudo-moar fd9238​: OUTPUT«*␤»
[07​:57] <dwarring> say min 10, 12, 42, 3
[07​:57] <FROGGS> so it becomes Inf-ish?
[07​:57] <dwarring> say 3 min 4
[07​:58] <dwarring> m​: say 3 min 4
[07​:58] <+camelia> rakudo-moar fd9238​: OUTPUT«3␤»
[07​:58] <colomon> where's that list of non-WhateverCode operators?
[07​:58] <dwarring> min can be used as an infix
[07​:59] <colomon> n​: say * min 2
[07​:59] <+camelia> niecza v24-109-g48a8de3​: OUTPUT«{ ... }␤»
[07​:59] <dwarring> but isn't currying as such
[07​:59] <colomon> I think this might be a rakudobug?
[07​:59] <FROGGS> perhaps it checks for an existing sub before it
checks for infixes?
[07​:59] <FROGGS> (just guessing)
[07​:59] <colomon> p6​: say (1..20).map(* min 3)
[08​:00] <dwarring> something to do with the signature (also guessing)
[08​:00] <+camelia> rakudo-jvm fd9238​: OUTPUT«(timeout)»
[08​:00] <+camelia> ..rakudo-parrot fd9238​: OUTPUT«No such method
'count' for invocant of type 'Int'␤ in method reify at
gen/parrot/CORE.setting​:7892␤ in method reify at
gen/parrot/CORE.setting​:7808␤ in method reify at
gen/parrot/CORE.setting​:7808␤ in method reify at
gen/parrot/CORE.setting​:7…»
[08​:00] <+camelia> ..rakudo-moar fd9238​: OUTPUT«No such method 'count'
for invocant of type 'Int'␤ in method reify at src/gen/m-
CORE.setting​:7943␤ in method reify at src/gen/m-CORE.setting​:7855␤
in method reify at src/gen/m-CORE.setting​:7855␤ in method reify at
src/gen/m-CORE.setting​:7956␤…»
[08​:00] <+camelia> ..niecza v24-109-g48a8de3​: OUTPUT«1 2 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3 3 3␤»
[08​:00] <colomon>
http://perlcabal.org/syn/S02.html#Operators_with_idiosyncratic_Whatever
[08​:01] <colomon> I don't see any reason this list should also include
min / max?
[08​:01] * TimToady sees no signatures with * offhand
[08​:02] <lizmat> m​: say (1..20).map​: { $_ min 3 } # works ok
[08​:02] <+camelia> rakudo-moar fd9238​: OUTPUT«1 2 3 3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3␤»
[08​:04] * grondilu notices that Digest still does not pass all tests
and looks into it
...
[08​:06] <lizmat> well, at any case, that error for say (1..20).map(*
min 3) is LTA
...
[08​:09] <dwarring> ^^ does this deserve a ticket (* min 2 not
currying)
[08​:09] <colomon> I guess (reading over it again) the spec question
is, should infix​:<min> be "Whatever-aware"?
[08​:09] <colomon> I can't think of any reason it should, but maybe
there's something I'm missing here.
[08​:10] <grondilu> retupmoca++
[08​:13] <TimToady> I'd call it a POLA bug
[08​:13] <TimToady> something is treating min as if it were a range
[08​:13] <lizmat> POLA?
[08​:14] <TimToady> just like POLS, only differnet
[08​:14] <colomon> POLS?
[08​:14] <TimToady> s/Surprise/Astonishment/

@p6rt
Copy link
Author

p6rt commented Dec 23, 2015

From @labster

The tests were unfudged in 113c002801 (and originally added in b85c0f344 and 469d6a545). Since they appear to be passing, resolving ticket.

On Fri Sep 05 18​:17​:19 2014, david.warring wrote​:

Fudged tests added to S02-types/whatever.t
Neither of 'min' and 'max' are currying. I've added tests for both of these.
On Fri Sep 05 13​:33​:39 2014, david.warring wrote​:

This issues was raised on SO
http://stackoverflow.com/questions/25669107/when-can-i-use-the-
whatever-star and has been discussed on #perl6 IRC.

The conclusion is that this behavior, although to spec, is a POL
(Principle of Least Astonishment) bug.

[07​:55] * dwarring looking at
http://stackoverflow.com/questions/25669107/when-can-i-use-the-
whatever-star
[07​:56] <dwarring> '* + 2' curries, but '* min 2' doesn't
[07​:56] <colomon> really?
[07​:57] <dwarring> m​: say * + 2
[07​:57] <+camelia> rakudo-moar fd9238​: OUTPUT«WhateverCode.new()␤»
[07​:57] <dwarring> m​: say * min 2
[07​:57] <+camelia> rakudo-moar fd9238​: OUTPUT«2␤»
[07​:57] <dwarring> yep
[07​:57] <FROGGS> m​: say * max 2
[07​:57] <+camelia> rakudo-moar fd9238​: OUTPUT«*␤»
[07​:57] <dwarring> say min 10, 12, 42, 3
[07​:57] <FROGGS> so it becomes Inf-ish?
[07​:57] <dwarring> say 3 min 4
[07​:58] <dwarring> m​: say 3 min 4
[07​:58] <+camelia> rakudo-moar fd9238​: OUTPUT«3␤»
[07​:58] <colomon> where's that list of non-WhateverCode operators?
[07​:58] <dwarring> min can be used as an infix
[07​:59] <colomon> n​: say * min 2
[07​:59] <+camelia> niecza v24-109-g48a8de3​: OUTPUT«{ ... }␤»
[07​:59] <dwarring> but isn't currying as such
[07​:59] <colomon> I think this might be a rakudobug?
[07​:59] <FROGGS> perhaps it checks for an existing sub before it
checks for infixes?
[07​:59] <FROGGS> (just guessing)
[07​:59] <colomon> p6​: say (1..20).map(* min 3)
[08​:00] <dwarring> something to do with the signature (also guessing)
[08​:00] <+camelia> rakudo-jvm fd9238​: OUTPUT«(timeout)»
[08​:00] <+camelia> ..rakudo-parrot fd9238​: OUTPUT«No such method
'count' for invocant of type 'Int'␤ in method reify at
gen/parrot/CORE.setting​:7892␤ in method reify at
gen/parrot/CORE.setting​:7808␤ in method reify at
gen/parrot/CORE.setting​:7808␤ in method reify at
gen/parrot/CORE.setting​:7…»
[08​:00] <+camelia> ..rakudo-moar fd9238​: OUTPUT«No such method 'count'
for invocant of type 'Int'␤ in method reify at src/gen/m-
CORE.setting​:7943␤ in method reify at src/gen/m-CORE.setting​:7855␤
in method reify at src/gen/m-CORE.setting​:7855␤ in method reify at
src/gen/m-CORE.setting​:7956␤…»
[08​:00] <+camelia> ..niecza v24-109-g48a8de3​: OUTPUT«1 2 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3 3 3␤»
[08​:00] <colomon>
http://perlcabal.org/syn/S02.html#Operators_with_idiosyncratic_Whatever
[08​:01] <colomon> I don't see any reason this list should also include
min / max?
[08​:01] * TimToady sees no signatures with * offhand
[08​:02] <lizmat> m​: say (1..20).map​: { $_ min 3 } # works ok
[08​:02] <+camelia> rakudo-moar fd9238​: OUTPUT«1 2 3 3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3␤»
[08​:04] * grondilu notices that Digest still does not pass all tests
and looks into it
...
[08​:06] <lizmat> well, at any case, that error for say (1..20).map(*
min 3) is LTA
...
[08​:09] <dwarring> ^^ does this deserve a ticket (* min 2 not
currying)
[08​:09] <colomon> I guess (reading over it again) the spec question
is, should infix​:<min> be "Whatever-aware"?
[08​:09] <colomon> I can't think of any reason it should, but maybe
there's something I'm missing here.
[08​:10] <grondilu> retupmoca++
[08​:13] <TimToady> I'd call it a POLA bug
[08​:13] <TimToady> something is treating min as if it were a range
[08​:13] <lizmat> POLA?
[08​:14] <TimToady> just like POLS, only differnet
[08​:14] <colomon> POLS?
[08​:14] <TimToady> s/Surprise/Astonishment/

@p6rt
Copy link
Author

p6rt commented Dec 23, 2015

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

@p6rt p6rt closed this as completed Dec 23, 2015
@p6rt
Copy link
Author

p6rt commented Dec 23, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant