Re: "Disappearing" code

2005-08-20 Thread David Formosa \(aka ? the Platypus\)
On Thu, 09 Jan 2003 21:12:07 -0500, John Siracusa <[EMAIL PROTECTED]> wrote: [...] > Hey, it adds up! Okay, maybe it doesn't...but still, Perl 6 Should Be Able > To Do This! :) And I'd also like inline constructs like: > > ASSERT $foo > 5 && is_happy(blah); macro debug ($code) is parsed

Re: "Disappearing" code

2003-01-14 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > John Siracusa asked: > >> 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

Re: "Disappearing" code

2003-01-12 Thread Damian Conway
Ken Fox wrote: Won't @message need lazy evaluation? How will Perl know to delay interpolation until the result of the "macro" is called at run time? Good point. It would also need to be slurped. So that's: sub debug is immediate is exported (*@message is lazy) { return $debuggi

Re: "Disappearing" code

2003-01-12 Thread Ken Fox
Damian Conway wrote: sub debug is immediate is exported (@message) { return $debugging ?? { print $*STDERR: @message; } :: {;} } Won't @message need lazy evaluation? How will Perl know to delay interpolation until the result of the "macro" is called at run time? - Ken

Re: "Disappearing" code

2003-01-10 Thread John Siracusa
On 1/10/03 12:24 PM, Damian Conway wrote: > "Immediate" subroutines are executed as soon as they are parsed (i.e. they're > like named BEGIN blocks). > > Returning a closure/block from an immediate sub called in a void context > (as C is in the example above) causes the immediate sub call to be >

Re: "Disappearing" code

2003-01-10 Thread Damian Conway
John Siracusa asked: 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 assert

Re: "Disappearing" code

2003-01-10 Thread John Siracusa
On 1/10/03 11:11 AM, Dan Brook wrote: > On Thu, 09 Jan 2003 19:55:20 -0500 > John Siracusa <[EMAIL PROTECTED]> wrote: >> 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 #

Re: "Disappearing" code

2003-01-10 Thread Dan Brook
On Thu, 09 Jan 2003 19:55:20 -0500 John Siracusa <[EMAIL PROTECTED]> wrote: > 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. If the perl6 command-l

Re: "Disappearing" code

2003-01-10 Thread Rafael Garcia-Suarez
John Siracusa <[EMAIL PROTECTED]> wrote: > > Well, er, don't we need to decide what the subroutine attribute is, so that > the compiler will know to honor it and make the code "disappear"? It > doesn't seem like a feature that can be added from "userland" after the fact > (but maybe I'm wrong...)

Re: "Disappearing" code

2003-01-10 Thread John Siracusa
On 1/9/03 11:27 PM, Michael G Schwern wrote: > On Thu, Jan 09, 2003 at 11:15:49PM -0500, John Siracusa wrote: >> On 1/9/03 10:10 PM, Michael G Schwern wrote: >>> I would assume it to be a compiler hint via subroutine attribute. >>> >>> sub debug ($msg) is off { >>> print STDERR $msg; >>> }

Re: "Disappearing" code

2003-01-10 Thread Michael G Schwern
On Thu, Jan 09, 2003 at 11:15:49PM -0500, John Siracusa wrote: > On 1/9/03 10:10 PM, Michael G Schwern wrote: > > I would assume it to be a compiler hint via subroutine attribute. > > > > sub debug ($msg) is off { > > print STDERR $msg; > > } > > > > some "this subroutine is a no-op if a

Re: "Disappearing" code

2003-01-10 Thread Michael G Schwern
On Thu, Jan 09, 2003 at 07:55:20PM -0500, John Siracusa wrote: > 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 attem

Re: "Disappearing" code

2003-01-09 Thread John Siracusa
On 1/9/03 10:10 PM, Michael G Schwern wrote: > I would assume it to be a compiler hint via subroutine attribute. > > sub debug ($msg) is off { > print STDERR $msg; > } > > some "this subroutine is a no-op if a flag is set" attribute. Hm, not quite as convenient as setting a package globa

Re: "Disappearing" code

2003-01-09 Thread John Siracusa
On 1/9/03 9:01 PM, Luke Palmer wrote: > Well, I just do: > > sub debug { > print STDERR shift, "\n" if DEBUG; > } > > And hopefully (I don't know P5 internals so well) that optimizes to a > no-op so there's not even a function call there. I don't know P5 internals so well either, but I'm guess

Re: "Disappearing" code

2003-01-09 Thread Luke Palmer
> Date: Thu, 09 Jan 2003 19:55:20 -0500 > From: John Siracusa <[EMAIL PROTECTED]> > > 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,

"Disappearing" code

2003-01-09 Thread John Siracusa
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 wa