> On 2 Sep 2022, at 22:52, ToddAndMargo via perl6-users <perl6-us...@perl.org> 
> wrote:
> 
> On 9/2/22 00:13, ToddAndMargo via perl6-users wrote:
>> Found something interesting
>> $ raku -c GetUpdates.pl6
>> Syntax OK
>> Will execute the BEGIN {}, not just
>> syntax check it.
> 
> The guys on the chat line said this is normal
> as `BEGIN` runs a compile time

How short *is* your memory?

> From: Elizabeth Mattijsen <l...@dijkmat.nl>
> Subject: Re: BEGIN {} question
> Date: 29 August 2022 at 09:44:30 CEST
> To: ToddAndMargo via perl6-users <perl6-us...@perl.org>
> 
>> Question, would BEGIN go at the top or the bottom
>> of my code?  Seems the compiler would hit it first
>> at the top, but I do not know if it makes a full
>> pass of everything before firing off the BEGIN.
> 
> BEGIN runs at *compile* time.
> 
> This means that anything before the BEGIN statement in the code, is compiled 
> and known and can be referenced in the BEGIN block.
> 
> Anything *after* the BEGIN statement is still unknown to the compiler and can 
> therefore *not* be referenced.
> 
> 
> Liz

Reply via email to