In Pugs's ext/Set/lib/Set.pm, there are a number of user-defined
infix operators.  To avoid unicode in mails, I'll use a hypothetical
&infix:<===> as the operator name.

Consider the sub case:

    class Set;
    sub infix:<===> (Set $x, Set $y) { ... }

Is it correct that this line:

    Set.new === Set.new

Only works when the &infix:<===> function is in scope?  That is, one
would need to add `is export` to its declaration for the user of the
Set module to access to this operator.

Does the same holds for `multi sub` as well?

What if this is expressed as a method:

    class Set;
    method infix:<===> (Set $y) { ... }

Does it also need `is export`?  If not, how does the parser know that
the === is a valid operator name, without the ability to deduce the type
of its left hand side object?  If yes, does it simply fail at runtime
if the left hand side has no infix:<===> defined?  Exporting a method
is a novel concept to me, too.

Thanks,
/Autrijus/

Attachment: pgpK9K0s7mTgB.pgp
Description: PGP signature

Reply via email to