in reply to Re^3: [Perl 6] $ and @ - what is it coming to?
in thread [Perl 6] $ and @ - what is it coming to?

The object might be "plural" to your mind, but is accessed via the object syntax $x.foo rather than being a @-sigil list variable.

Upon further reading, I understand that @ variables can be bound at compile-time to any class that supports the Positional role. Though I think that can lead to subtle issues as well, such as losing the class when doing assignment.

—John

Replies are listed 'Best First'.
Re^5: [Perl 6] $ and @ - what is it coming to?
by moritz (Cardinal) on Mar 31, 2008 at 12:36 UTC
    Though I think that can lead to subtle issues as well, such as losing the class when doing assignment.

    Uhm, you lose the type of scalar as well if you assign to the variable that holds it.

    my $a = 'Foo'; # $a isa Str now $a = 42; # $a isa Int now

    You're just used to dealing with it with scalars

    my @list = CustomList.new(); @list = @other_list; # you lose @list's type as well # assignment that preservers the type has to # assign to the contents, not the container: @list[*] = @other_list;