On Mon, Apr 25, 2005 at 05:18:11AM -0600, Luke Palmer wrote:
> David Storrs writes:
> >   sub foo {
> >       my ($x,$y) = @_;
> >       note("Entering frobnitz().  params: '$x', '$y'"); 
> >       ...
> >   }
> > This, of course, throws an 'uninitialized value in concatenation or
> > string' warning when your test suite does this:
> >   is( foo(undef, undef), undef, "foo(undef, undef) gives undef" );
> > How would I best solve this problem in Perl6?
> 
> Of course, no ordinary definition of a note() sub will work, since the
> concatenation happens before note is even touched.  

Exactly; that's why I asked "how would I solve this", instead of "how
would I write note()".


> However, a macro could do it.  It might go something like this:
> 
>     macro note(Perl::Expression $expr) 
>         is parsed(/$<expr> := <Perl.arglist(:(Str))>/)
>     {
>         $expr.compile(:warnings(0));
>     }
> 
> Luke

Cool.  But that seems to turn off all warnings during the compilation
of the expression--I only want to get rid of the (expected)
'uninitialized' warning.  Will there be a way to do finer-grained
control? 

--Dks
-- 
[EMAIL PROTECTED]

Reply via email to