Fractional/negative fixity?

Robert Dockins robdockins at fastmail.fm
Wed Nov 8 21:12:01 EST 2006


On Wednesday 08 November 2006 21:02, Jan-Willem Maessen wrote:
> On Nov 7, 2006, at 5:49 PM, Robert Dockins wrote:
> [On operator precedence]
>
> > Ha! Well, as long as we're being pedantic, surely we wouldn't need
> > any set
> > larger than the rationals (which does have a decidable ordering)?
> >
> > Also, since I'm commenting anyway, I rather like the idea of
> > specifying
> > operator precedences via a partial order.  However, I also feel
> > that there
> > needs to be some work done to make sure there aren't gremlins
> > hiding in the
> > details.  Has anyone worked out the theory on this?  How does
> > associating to
> > the right vs left play into the picture?  How does it fit into the
> > parsing
> > technology?
>
> Actually, we *do* use a DAG on operator precedence in the Fortress
> programming language (my day job).

Huh... I didn't know that.  Are there any good papers/documentation on the 
system you use?

> Our goal is to require 
> parentheses when it is not blatantly obvious what is going on (eg
> because we're using operators from two libraries written in
> isolation).  We can only use operators together in an expression
> without parentheses if there is an edge between them in the graph.
> Graph nodes are sets of operators with the "same" precedence (eg
> addition and subtraction).  Among other things this means that if ++
> has higher precedence than ==, and == has higher precedence than &&,
> we can't necessarily mix ++ and && in the same expression without
> parentheses.

> That said, this would be a pretty big change for Haskell, and would
> break existing code unless you somehow wired in the transitive
> closure of all the existing operators.  As another message in this
> discussion (from Simon M?) mentioned, you might want to be able to
> specify the relationship between operators imported from different
> modules, because you *do* know that a well-known relationship exists.

So the Fortress system doesn't use transitivity automaticly? And what about 
operator parsing associativity?  Do you require that all operators assigned 
to the same node in the DAG have the same associativity?


> -Jan-Willem Maessen


-- 
Rob Dockins

Talk softly and drive a Sherman tank.
Laugh hard, it's a long way to the bank.
       -- TMBG


More information about the Haskell-prime mailing list