Hi,

class and role bodies are executed at compile time, so yes, that's
expected. The same thing happens in BEGIN blocks.

(Actually, the case with roles is more complicated; iirc their bodies
are executed at role application time, but in your example, 'class B
does Xx' runs at compile time, so the two are roughly equivalent).

Cheers,
Moritz

On 06/15/2014 02:31 AM, Kamil Kułaga wrote:
> Hi,
> 
> I got amazed little bit when this code:
>     class A {
>          method wow{say "I'm alive"}
>     }
> 
>     role Xx{
>       my $th = A.wow;
>     }
> 
> 
>     class B does Xx {
>     }
> 
> Started to live during compilation (also tried with ufo):
> 
>     $ perl6 -o o.pir funnyrole.pl
>     I'm alive
> 
> 
> Is this expected or subject to change?
> 

Reply via email to