[Haskell-cafe] Fractional/negative fixity?
jo at durchholz.org
Tue Nov 7 18:08:00 EST 2006
David House schrieb:
> Also, it provides an infinite space for fixities. I think the problem
> 'binds tighter than X but not as tight as Y', where X and Y are only
> fixity integer apart is somewhat common, and this would fix it. It
> would allow for extensibility into the future, where the operator
> space will only become more dense, and maintaining a complete order
> with only 10 integers to play will become more and more difficult.
> Allowing an infinite amount of operators to come between any two
> operators sounds like a solid design decision to me.
Yes, but allowing simply to specify some ordering relationship to
existing operators is an even more solid one.
Fractional fixities are overspecification, and this can hurt in
scenarios like this one:
Developer A creates an operator with this fixity declaration:
infixl 6.25 +*
Developer B has this:
infixl 6.75 *+
(They don't use 6.5 because each has another operator at 6.5 already.)
Now when some developer mixes +* and *+ in the same expression, the
compiler will automatically assign a relative priority for the two
operators, even though it's not at all clear whether the two operators
have any relative precedence - it would be far preferable if the
compiler simply declared nonpriority and emitted an error, forcing the
programmer to clearly state what priorities he had in mind when writing
down the expression.
I know the above example is a bit far-fetched. And it's not a really
important issue anyway.
More information about the Haskell-Cafe