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

Can't mix role into type object in Rakudo #2279

Closed
p6rt opened this issue Nov 27, 2010 · 5 comments
Closed

Can't mix role into type object in Rakudo #2279

p6rt opened this issue Nov 27, 2010 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Nov 27, 2010

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

Searchable as RT79868$

@p6rt
Copy link
Author

p6rt commented Nov 27, 2010

From @masak

<masak> rakudo​: my $x = [] but role {}; say "alive"
<p6eval> rakudo : OUTPUT«alive␤»
<masak> rakudo​: my $x = class {} but role {}; say "alive"
<p6eval> rakudo : OUTPUT«Attempt to use rebless_subclass where the new
class was not a subclass␤ in 'infix​:<does>' [...]
* masak submits rakudobug
<masak> rakudo​: role R {}; my $x = class {} but R; say "alive"
<p6eval> rakudo : OUTPUT«Attempt to use rebless_subclass where the new
class was not a subclass␤ in 'infix​:<does>' [...]
<jnthn> masak​: That one is because of the way type objects are done.
<masak> rakudo​: role R {}; my $x = (class {}).new but R; say "alive"
<p6eval> rakudo : OUTPUT«alive␤»
<masak> ah.
<jnthn> Yeah.
<jnthn> Trying to fix that was one of the things that told me, "OK, we
need type objects to REALLY be the same type"
<masak> rakudo​: my $x = (role {}) but role {}; say "alive"
<p6eval> rakudo : OUTPUT«Attempt to use rebless_subclass where the new
class was not a subclass␤ in 'infix​:<does>' [...]
<masak> jnthn​: same as what?
<masak> ah.
<masak> as their instantiated cousins.
<masak> yeah, that sounds like a good idea.
<jnthn> Right :)

@p6rt
Copy link
Author

p6rt commented Jan 13, 2012

From @jnthn

On Sat Nov 27 14​:28​:35 2010, masak wrote​:

<masak> rakudo​: my $x = [] but role {}; say "alive"
<p6eval> rakudo : OUTPUT«alive␤»
<masak> rakudo​: my $x = class {} but role {}; say "alive"
<p6eval> rakudo : OUTPUT«Attempt to use rebless_subclass where the new
class was not a subclass␤ in 'infix​:<does>' [...]
* masak submits rakudobug
<masak> rakudo​: role R {}; my $x = class {} but R; say "alive"
<p6eval> rakudo : OUTPUT«Attempt to use rebless_subclass where the new
class was not a subclass␤ in 'infix​:<does>' [...]

Now​:

my $x = class {} but role {}; say "alive"
alive

Note also that​:

my $x = class {} does role {}; say "alive"
Cannot use 'does' operator with a type object

Which makes sense, as you'd be changing a type object in place, which
would be bad.

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Jan 13, 2012

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

@p6rt
Copy link
Author

p6rt commented Apr 5, 2012

From @moritz

now tested in S14-roles/mixin.t

@p6rt
Copy link
Author

p6rt commented Apr 5, 2012

@moritz - 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