TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
HaloO,
John M. Dlugosz wrote:
How do you declare a function that returns an array? Something like
sub foo (blah) is Array of X { ... }
I meant "of", not "is".
In general the of keyword instanciates parametric types just like
the direct indexing of typenames with []. The only unspecced thing
is the variance of ::Foo[::Bar] with respect to ::Bar.
Variance?
So that brings me to the second problem. For parameters, it's no
problem because people just use the @ sigil and don't think about
containers. So how do I do that with the return value? I don't name
the return value, so there is no place to put the sigil.
sub foo (blah) is X @*
Should be 'sub foo( --> X *@)' or 'our X *@ sub foo()'. In case that
this doesn't parse 'our :(X *@) sub foo()' should.
No, *@ is the slurpy array parameter. I was thinking of
(*,*,$x) = @array; # skips first two elements
to suppose that @* might mean "no name" if the syntax would not allow
for bare @ there without an identifier.