Jonathan Worthington jonathan-at-jnthn.net |Perl 6| wrote:
Hi,
Little clarification...
Henry Baragar wrote:
I think that in your "Example 1", that you may be making too making
too much of a distinction between "$a" and "@a". That is:
sub f2(@y) {...}
has exactly the same signature as sub f2($x is Array) {...}
In other words, they both take a single argument that must be of type
Array.
@y just means "the argument must do the Positional role", so it's a
looser constraint than "is Array". Equivalent is more like:
sub f2(Positional $x) { }
Thanks,
Jonathan
I'm finding a difference in how a Positional is "bound to" a plain item
variable.
If the paramter-argument bond is shown as:
my $x := @A;
how can the Item variable "really" bond _directly_ to the Positional
object? It doesn't have STORE and FETCH methods. The item variable
forwards methods to the contained item, and a directly-bonded Array does
not.
I think I'm assuming more is (can be) happening at compile time.
The delegation would have to be handled at run-time, rather than as
something the compiler knows about?
Thanks,
--John