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

Making a parameter of a BUILD submethod a uint8 triggers a bytecode validation error in Rakudo #5216

Closed
p6rt opened this issue Apr 6, 2016 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Apr 6, 2016

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

Searchable as RT127845$

@p6rt
Copy link
Author

p6rt commented Apr 6, 2016

From @masak

<psch> m​: class A { has uint8 $.x; submethod BUILD(​:$!x) { } };
A.new(​:x(5)).perl.say # but..?
<camelia> rakudo-moar c8ec5a​: OUTPUT«Cannot modify an immutable uint8␤
in submethod BUILD [...]»
<moritz> m​: class A { has uint8 $.x; submethod BUILD(uint8 :$!x) { }
}; A.new(​:x(5)).perl.say
<camelia> rakudo-moar c8ec5a​: OUTPUT«Bytecode validation error at
offset 102 [...]»
<moritz> psch​: I think the problem is that argument binding is
*binding*, and you cannot bind to natively typed containers
<moritz> or something along those lines
<moritz> of course, that's LTA :/
<psch> especially with the roundabout binding hidden in the submethod invocation
<psch> that's gonna be a fun awesome error message to think up... :)
<moritz> well, I'd hope that we can modify the argument binding to
deal with native attributes properly
<moritz> though I'm not nearly deep enough into the trench to know how
feasible that is
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Jul 21, 2017

From @dogbert17

On Wed, 06 Apr 2016 01​:30​:45 -0700, masak wrote​:

<psch> m​: class A { has uint8 $.x; submethod BUILD(​:$!x) { } };
A.new(​:x(5)).perl.say # but..?
<camelia> rakudo-moar c8ec5a​: OUTPUT«Cannot modify an immutable uint8␤
in submethod BUILD [...]»
<moritz> m​: class A { has uint8 $.x; submethod BUILD(uint8 :$!x) { }
}; A.new(​:x(5)).perl.say
<camelia> rakudo-moar c8ec5a​: OUTPUT«Bytecode validation error at
offset 102 [...]»
<moritz> psch​: I think the problem is that argument binding is
*binding*, and you cannot bind to natively typed containers
<moritz> or something along those lines
<moritz> of course, that's LTA :/
<psch> especially with the roundabout binding hidden in the submethod
invocation
<psch> that's gonna be a fun awesome error message to think up... :)
<moritz> well, I'd hope that we can modify the argument binding to
deal with native attributes properly
<moritz> though I'm not nearly deep enough into the trench to know how
feasible that is
* masak submits rakudobug

Fixed with rakudo/rakudo@77a2ff1.
Tests needed

@p6rt
Copy link
Author

p6rt commented Jul 21, 2017

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

@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

From @zoffixznet

Tests​: Raku/roast@a894326bfe50a10e3a083777

@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

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

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

No branches or pull requests

1 participant