On Mon, Apr 03, 2006 at 07:23:28PM -0700, Joshua Choi wrote:
: Kudos to all on the Perl 6 mailing list,
:
: What's the conceptual difference (or relationship) between context and type
: coercion? Is
: $moose.prefix:<~>
: the same as
: $moose.coerce:(Str)
: for instance?
No difference.
: And forgive my brain, but how would you nicely define coercion in a class?
: Like, could you spare an example?
Currently something like:
multi submethod infix: ($self: Str) {...}
multi submethod infix: ($self: Int) {...}
or
multi sub infix: (MyClass $self, Str) {...}
multi sub infix: (MyClass $self, Int) {...}
: Also, what's the point of making a whole grammatical category for "coerce"
: that behaves like an infix operator?
In the current synopses there is no "coerce" grammatical category
any more. Everything is subsumed under infix:, at least this week...
There's some discussion about whether it should simply be:
method as (Str) {...}
method as (Int) {...}
maybe with an "is deep" thrown in for good measure, but we haven't
quite got there yet.
Larry