On 8/8/06, Yuval Kogman <[EMAIL PROTECTED]> wrote:
On Tue, Aug 08, 2006 at 11:12:11 +0100, Daniel Hulme wrote:

> I may be in a little world of my own here, but isn't this what 'as' is
> supposed to do?
>
> foo($x as Moose);

as is a method invocation not a type annotation... It's related, but
not the same (last I heard)

Yep, in a perl5esque execution model, they should be the same thing,
but in a type-inferred environment they're two different things.
Assume such an environment:

   my $x = Foo.new;   # $x is a Foo
   foo($x as Bar);  # passed a Bar
   foo($x);         # passed a Foo

vs.

   my $x = Foo.new;   # coersed to Bar
   foo($x :: Bar);  # passed a Bar
   foo($x);         # passed a Bar

Which, needless to say, scares me a little.  It is difficult to get
coersion and type inference to mix.

Luke

Reply via email to