Yes, this is why phasers are awesome. They allow you to write code in
a "natural" order, but the phasers will basically time-travel the code
around to where you send it. The two `now` calls execute in two
completely different environments; the first one in the runtime, the
second one during the parsing of the program.

This, incidentally, is the frame of mind one has when writing macros,
too. Most of the action around macros happen at BEGIN time, while the
program is still being processed by the compiler.

/me wanders off towards the horizon, rambling on about macros

// Carl

On Mon, Jan 12, 2015 at 11:33 AM, Gabor Szabo <ga...@szabgab.com> wrote:
>
>
> On Mon, Jan 12, 2015 at 11:48 AM, Tobias Leich <em...@froggs.de> wrote:
>>
>>
>> $ perl6 -e 'sleep 3; say now - BEGIN now;'
>> 3.0180351
>>
>
>
> Oh, so this what they call bending time around space. (Or was that the other
> way around?)
> You call now in the BEGIN block which is the first thing to finish in that
> code, but it is placed
> later in the script so it will appear only after the sleep and the second
> now (written as first now)
> will have been executed.
>
> It's clear.
>
> :)
>
> Gabor
>

Reply via email to