On 9/2/22 18:14, ToddAndMargo via perl6-users wrote:
On 9/2/22 13:52, ToddAndMargo via perl6-users 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



Hi All,

Thinking about it, I thought I did not bring
enough attention to the `-c` switch in the
above command line.  This runs a SYNTAX check
and stops at that.  It does not run the program.
I use the `-c` option extensively to debug my
typos before debugging my programs.

When I found BEGIN actually running when all
I wanted was a syntax check, I was perplexed.
My understanding was that -c only checked my
syntax, including my BEGIN block.

This is why I asked on the chat line. Bug
or suppose to be?  And the answer is that
is just turned out that way.  And that is
fine with me.

:-)

-T

Hi All,

For the fun of it, I placed a "booboo;"
in the BEGIN block to see what the syntax
checker would do:

$ raku -c GetUpdates.pl6
===SORRY!=== Error while compiling /home/linuxutil/GetUpdates.pl6
Undeclared routine:
    booboo used at line 28

Caught it.  No BEGIN pop up



Then I moved the booboo to the end of the
program

$ raku -c GetUpdates.pl6
===SORRY!=== Error while compiling /home/linuxutil/GetUpdates.pl6
Undeclared routine:
    booboo used at line 11664

Caught it.  And I also got the BEGIN's pop up.

Interesting!

:-)

-T

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to