Perl6 RFC Librarian wrote:
> The bounds of an array or list can be specified at run time, of course:
>
> my int @t1 :bounds(@dimList) = getFromSomeplace();
Hm, I think some clarification would be good. I'd imagine three cases:
(1) getFromSomeplace returns an untyped and unbounded LOL. In that case
I'd write
my int @t1 : bounds = getFromSomeplace();
and the bounds should be automatically figured out from the returned
LOL. (2) getFromSomeplace returns already a typed bounded array:
my @t1 = getFromSomeplace();
or (3) getFromSomeplace returns a normal perl list or LOL and I want it
to be reshaped (according to @dimList with clipping?) into my new bound
array:
my int @t1 :bounds(@dimList) = getFromSomeplace();
>
> Where the type and bounds of an array can be derived at run time, it is
> not necessary to specify them explicitly:
>
> my int @t1 :bounds(@dimList) = getFromSomeplace();
> my int @t2 :bounds(@dimList) = getFromSomeplaceElse();
> my @prod = @t1 * @t2; # @prod magically has type (int) and :bounds (@dimlist)
What happens when pairing typed/untyped bounded/unbounded arrays in such
operations. The stricter one wins? I'd imagine the usual type
conversions happen automatically. Should there be an RFC detailing the
data types and conversions that one would want, e.g. a complex type,
etc?
> and its bounds can be locked in as well if required:
>
> my @some_LOL = ([1,2],
> [3,4]);
> my int @array :bounds(@#some_LOL) = @some_LOL;
>
Again, couldn't we just imply the bounding, i.e.
my int @array :bounds = @rvalue;
always meaning
my int @array :bounds(@#rvalue) = @rvalue;
Christian