Has there been any discussion of how to create code in Perl 6 that's there
under some conditions, but not there under others?  I'm thinking of the
spiritual equivalent of #ifdef, only Perlish.

In Perl 5, there were many attempts to use such a feature for debugging and
assertions.  What everyone wanted to do was write code like this:

    debug("Doing foo with $bar and $baz");
    foo($bar, $baz);

And then have the entire call to debug() just plain disappear when the
program was run with a certain flag, or when a particular constant was set,
or whatever.  The closest we got in Perl 5, AFAIK, was stuff this:

    use constant DEBUG => 0;
    ...
    debug("Doing foo with $bar and $baz") if DEBUG;
    foo($bar, $baz);

But all those "if DEBUG"s or "DEBUG &&"s were a pain.  So I'm wondering what
the solution will be in Perl 6.

-John

Reply via email to