On Sun, May 20, 2001 at 06:19:35PM -0400, Uri Guttman wrote:
> >>>>> "DC" == Damian Conway <[EMAIL PROTECTED]> writes:
> 
> 
>   DC>         return undef Because($borked);
> 
> hmm, that is poor code as returning a real undef will break in a list
> context.

I always balk when I see someone say that. This is perfectly valid thing todo.
If the sub is defined to return a single scalar value then C<return;> is
the WRONG thing todo as it will cause problems if the result is used directly
into a list.

> so how would a value property be attached passed back to an
> empty list? what happens below:

Thats a good point. But on the other hand an empty list is neither
a variable or a value. You are returning nothing, so there is nothing
to attach it too.

But with the ability to return arrays in perl6 you should probably return
an empty array with a property attached.

>       perm_props( $foo, 'SortCode' ) = 'ST' ;
> 
> the last one assigns the prop value with an lvalue call.

If perm_props returns a hash, then you could also do

        perm_props( $foo ){'SortCode'} = 'ST' ;

Graham.

Reply via email to