I don't quite follow the unease from this example, but that's
probably because of the way that Perl 6 thinks of "undefined"
being different from Perl 5's "undef" and "defined". 

In particular:

> ...
> sub array {
>     my $what = shift;
>     my $array = [];
>     return $array if $what eq 'undef';

Perl 6 wouldn't treat C< my $array = []; >  as having
any sort of "undefined" result -- it's absolutely
a defined Array (albeit empty).  In Perl 6, the way
one would obtain an undefined array is with something
like

    my $array = Array;

or

    my @array;    # rakudo currently gets this wrong,
                  # which is part of what brought up
                  # the discussion on #perl6  :-)

Or, put another way, in Perl 6 an undefined array
is denoted by its type object (just like most other
undefined values such as Int, Str, etc.).

Hope I've not just confused things even further.

Pm

Reply via email to