On Tue, Mar 11, 2003 at 01:25:41PM +1100, Damian Conway wrote:
: >3) The edge point between explicitly typed and explicitly non-typed 
: >variables:  If you pass an "untyped" array (or list?) to an explicitly 
: >typed array parameter, is the "untyped" array considered a unique case, 
: >or will it fail?
: >
: >  multi foo (@a is Array of int) {...}
: >
: >  my int @a = baz();     # is Array of int
: >  my     @b = baz();     # is Array of Scalar
: >
: >  foo(@a);    # @a is typed correctly, so OK
: >  foo(@b);    # @b is not explicitly typed as C<int>; OK or FAIL?
: 
: Fails.
: 
: Because:
: 
:       not (Array of Scalar).isa(Array of int)
: 
: Which in turn is because:
: 
:       not Scalar.isa(int)

I dunno.  I can argue that it should coerce that.  It'll certainly be
able to coerce a random scalar to int for you, so it's not a big stretch
to coerce conformant arrays of them.  On the other hand, it's likely
to be expensive in some cases, which isn't so much of an issue for
single scalars/ints/strs.

Larry

Reply via email to