On Wed, Jul 25, 2018 at 11:48:30AM -0700, ToddAndMargo wrote:
> Maybe I am trying to get "-c" to do too many things.
> 
> What I would like it to do is to check everything right up to but not
> actually run the program.

Part of the challenge here is that unlike many other programming languages, 
Perl 6 is designed to be very dynamic.  The compiler actually executes some 
components of the program as it scans them -- i.e., before it's had a chance to 
check (or even read) the entire source code file.  

So it's a little challenging in Perl 6 to say "but not actually run the 
program".  

A more accurate/do-able thing might be to simply say "load everything but don't 
run the mainline".  In code this could perhaps be achieved with something like:

   INIT { exit 0; }

This means that BEGIN and CHECK blocks still run, as well as potential other 
declarations that have executable side effects, but the mainline doesn't ever 
get run.  Perhaps there's a case to be made that "-c" or a similar option 
should do something like this, or have "-c" simply stop after the CHECK phase 
of evaluation.

Pm

Reply via email to