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

Int type object is much stricter with infix:<%> than Any in Rakudo #3327

Open
p6rt opened this issue Feb 3, 2014 · 3 comments
Open

Int type object is much stricter with infix:<%> than Any in Rakudo #3327

p6rt opened this issue Feb 3, 2014 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 3, 2014

Migrated from rt.perl.org#121154 (status was 'open')

Searchable as RT121154$

@p6rt
Copy link
Author

p6rt commented Feb 3, 2014

From @masak

<masak> r​: subset Odd of Int where { $_ % 2 }; my Odd $o; say $o; say $o % 2
<camelia> rakudo-parrot 4a74e7​: OUTPUT«(Odd)␤Invocant requires an
instance, but a type object was passed [...]
<camelia> ..rakudo-jvm 4a74e7​: OUTPUT«(Odd)␤Cannot look up attributes
in a type object [...]
<camelia> ..rakudo-moar 4a74e7​: OUTPUT«(Odd)␤Invocant requires an
instance, but a type object was passed [...]
<masak> huh.
<masak> r​: my Int $i; say $i % 2
<camelia> rakudo-moar 4a74e7​: OUTPUT«Invocant requires an instance,
but a type object was passed [...]
<camelia> ..rakudo-parrot 4a74e7​: OUTPUT«Invocant requires an
instance, but a type object was passed [...]
<camelia> ..rakudo-jvm 4a74e7​: OUTPUT«Cannot look up attributes in a
type object [...]
<masak> I don't remember infix​:<%> behaving like that.
<masak> I expected it to warn, but assume that an undefined Int numifies to 0.
<masak> r​: my Int $i; try say $i % 2; say "alive"
<camelia> rakudo-parrot 4a74e7, rakudo-jvm 4a74e7, rakudo-moar 4a74e7​:
OUTPUT«alive␤»
<masak> n​: my Int $i; try say $i % 2; say "alive"
<camelia> niecza v24-109-g48a8de3​: OUTPUT«0␤alive␤»
<masak> I say Niecza has it right. any comments from anyone before I
submit a rakudobug?
<masak> r​: my $x; say $x % 2
<camelia> rakudo-parrot 4a74e7​: OUTPUT«use of uninitialized value of
type Any in numeric context [...] ␤0␤»
<camelia> ..rakudo-jvm 4a74e7, rakudo-moar 4a74e7​: OUTPUT«use of
uninitialized value of type Any in numeric context␤0␤»
<masak> that's what I expect from Int undefined values, too.
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Dec 2, 2017

From @AlexDaniel

So the gist of it is that Any % 2 is 0 but Int % 2 is an error. Still reproducible (2017.11, HEAD(5929887))

On 2014-02-03 05​:44​:28, masak wrote​:

<masak> r​: subset Odd of Int where { $_ % 2 }; my Odd $o; say $o; say
$o % 2
<camelia> rakudo-parrot 4a74e7​: OUTPUT«(Odd)␤Invocant requires an
instance, but a type object was passed [...]
<camelia> ..rakudo-jvm 4a74e7​: OUTPUT«(Odd)␤Cannot look up attributes
in a type object [...]
<camelia> ..rakudo-moar 4a74e7​: OUTPUT«(Odd)␤Invocant requires an
instance, but a type object was passed [...]
<masak> huh.
<masak> r​: my Int $i; say $i % 2
<camelia> rakudo-moar 4a74e7​: OUTPUT«Invocant requires an instance,
but a type object was passed [...]
<camelia> ..rakudo-parrot 4a74e7​: OUTPUT«Invocant requires an
instance, but a type object was passed [...]
<camelia> ..rakudo-jvm 4a74e7​: OUTPUT«Cannot look up attributes in a
type object [...]
<masak> I don't remember infix​:<%> behaving like that.
<masak> I expected it to warn, but assume that an undefined Int
numifies to 0.
<masak> r​: my Int $i; try say $i % 2; say "alive"
<camelia> rakudo-parrot 4a74e7, rakudo-jvm 4a74e7, rakudo-moar 4a74e7​:
OUTPUT«alive␤»
<masak> n​: my Int $i; try say $i % 2; say "alive"
<camelia> niecza v24-109-g48a8de3​: OUTPUT«0␤alive␤»
<masak> I say Niecza has it right. any comments from anyone before I
submit a rakudobug?
<masak> r​: my $x; say $x % 2
<camelia> rakudo-parrot 4a74e7​: OUTPUT«use of uninitialized value of
type Any in numeric context [...] ␤0␤»
<camelia> ..rakudo-jvm 4a74e7, rakudo-moar 4a74e7​: OUTPUT«use of
uninitialized value of type Any in numeric context␤0␤»
<masak> that's what I expect from Int undefined values, too.
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Dec 2, 2017

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

@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