# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #120916] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=120916 >
<FROGGS> I could just make a role (Slangy) that stubs attributes... wait, we don't have that feature :o) <FROGGS> or do we? <FROGGS> p: my role Slangy { has $.grammar = ...; }; class COBOL does Slangy { } <camelia> rakudo-parrot a77214: ( no output ) <FROGGS> p: my role Slangy { has $.grammar = ...; }; class COBOL does Slangy { }; my $cobol = COBOL.new <camelia> rakudo-parrot a77214: OUTPUT«Stub code executed [...] <FROGGS> cool <FROGGS> p: my role Slangy { has $.grammar = ...; }; class COBOL does Slangy { }; my $cobol = COBOL.new( :grammar ) <camelia> rakudo-parrot a77214: ( no output ) <FROGGS> very nice <masak> FROGGS: though it could be argued that the above should blow up at composition-time. <masak> as in, at the final '}' after the 'does Slangy'. <FROGGS> true, but it is good enough for me <masak> p: role R { method foo { ... } }; class C does R {}; BEGIN { say "alive" } <camelia> rakudo-parrot a77214: OUTPUT«===SORRY!===Method 'foo' must be implemented by C because it is required by a role» <masak> FROGGS: yes, I'm just thinking from the perspective of rakudobugs ;) * masak submits one I'm not aware that the spec requires stubbed attributes to blow up at composition time. So consider this 50% a rakudobug, 50% a spec (clarification) request. I can submit a separate spec issue too if anyone feels that'd be a good idea. Even if we arrive at the conclusion that stubbed attributes in roles shouldn't work like that, I think that "Stub code executed" is LTA in this case. Why not something like "Cannot instantiate: Attribute $.grammar not initialized" ?