On Fri, Oct 20, 2006 at 09:10:12AM -0700, Jonathan Lang wrote:
: TSa wrote:
: >Here is yet another idea to go with the two lattice operations:
: >
: >   /\ meet   also: infimum,  intersection, glb (greatest lower bound)
: >   \/ join   also: supremum, union,        lub (least upper bound)
: 
: I have to admit: if it turns out that '&' and '|' can't be used for
: 'intersection' and 'union', '/\' and '\/' wouldn't be the worst
: choices to replace them.  But I'd like to verify that we can't use
: what we currently have first, before we go changing things.

I think we should reserve | and & for matching predicates (read: signatures
and where clauses) rather than type construction.  We have to remember
that type theory is completely inside-out to the way most Perl programmers
think.  Type theory is all about Platonic objects and how you go about
constructing such abstractions in the abstract.  Most people don't want to
think on that level, and are quite willing to delegate the high-powered
abstractions to someone else.  Therefore I'd like these to be illegal:

    subset X of Y | Z;
    subset X of Y & Z;
    subset X of Y ^ Z;

and need to be written more like:

    subset X of Any where Y | Z;
    subset X of Any where Y & Z;
    subset X of Any where Y ^ Z;

I now think it's a bad idea to overload | or & to do type construction,
especially since the tendency is to define them backwards from the
operational viewpoint that most Perl programmers will take.

: >and also read nice as english words:
: >
: >   role J joins A, B, C; # same as role J does A \/ B \/ C
: >   role M meets A, B, C; # same as role M does A /\ B /\ C
: 
: I'm less enthusiastic about this, though: perl already uses 'join' for
: list concatenation.

We can negotiate the color of the bikeshed over time.  I don't
personally have a problem with meets and joins, and while you might
think that \/ makes it impossible to write [\/] to get a reducing
divide, that's not an operator you'd likely want anyway.  But one of
the basic underlying principles of Perl 6 is that we don't have to
overload different operators in a confusing way anymore.  \/ should
probably be the ASCII workaround for ∨ while /\ is the ASCII for ∧.
And at one point @Larry reserved all the parenthesized operators for
the ASCII workarounds for set operators.

Anyway, I think the type constructors need to avoid overloading the
logic operators.  Perl 6 is an operator-rich language because that
contributes to long-term clarity despite the short-term confusion.

Larry

Reply via email to