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
Subclassing an Int no longer works flawlessly (my Foo $a .= new(42)) #5928
Comments
From @AlexDanielCode: Result (2016.09): Result (HEAD): Bisectable points to rakudo/rakudo@798c2e2 <Zoffix> AlexDaniel, please rakudobug it. I'll take a look tomorrow. At least half of rakudo/rakudo@798c2e2 is wrong, because that comment lies; it doesn't give a "decoupled" Int |
From @zoffixznetOn Wed, 28 Dec 2016 18:58:00 -0800, alex.jakimenko@gmail.com wrote:
Looking deeper into it, the comment doesn't lie, it does seem to work to decouple from cached constants: # HEAD # 2012.15 Can't figure out how to get the cake and eat it too, though... I can either make it create a new self.WHAT maintaining subclassing object OR handle huge values like 2⁶⁴ correctly. Other than doing something stupid, like coercing it to Str and then using nqp::fromstr_I :/ |
The RT System itself - Status changed from 'new' to 'open' |
From @AlexDanielAnother case: class MyInt is Int { method even(){ self %% 2 } }; say [1..4].map({ MyInt.new($_) }).grep({.even}) Seems like it is a common thing to try, but I'm not going to say that it should work. Maybe it should throw a warning or something? If the warning can give clear instructions on how to do this kind of stuff, then I'd say we provided enough cakes. On 2016-12-28 18:58:00, alex.jakimenko@gmail.com wrote:
|
From @zoffixznetOn Thu, 29 Dec 2016 19:26:07 -0800, alex.jakimenko@gmail.com wrote:
This was already fixed awhile back and I'm 100% sure there are tests covering the issue as well (this was around when nqp::fromI_I was being introed to fix constant caching here) |
@zoffixznet - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#130431 (status was 'resolved')
Searchable as RT130431$
The text was updated successfully, but these errors were encountered: