Sun Microsystems Laboratories Experimental Stuff [Fortress-interest] sizeof operator binding

[Fortress-interest] sizeof operator binding

Jan-Willem Maessen Janwillem.Maessen@sun.com
Sun, 21 Jan 2007 22:10:47 -0500


On Jan 21, 2007, at 12:55 PM, Mike Atkinson wrote:

> I would expect the sizeof operator to bind more tightly than  
> (almost?) anything else, however
>
> for i <- |old|)#|new|-|old| do
> end
>
> where old and new are of type HeapSequence, does not work, only
>
> for i <- (|old|)#((|new|)-(|old|)) do
> end
>
> seems to work.

The general Fortress philosophy on operator binding is "if there  
isn't an already-defined precedence in mathematics, you must use  
parentheses to disambiguate."  The # isn't a well-known mathematical  
operator, thus it doesn't have a defined precedence with respect to  
other operators.  We may relax this in future, but probably not to  
the point where your example works without parentheses.

Note in general that Fortress operators don't bind "tightly" or  
"loosely" per se; precedence is defined between pairs of operators.   
So for example < binds more tightly than AND and less tightly than +,  
but AND and + require parentheses if you use them without a  
relational operator in between.

-Jan-Willem Maessen

>
> Mike Atkinson
>
> _______________________________________________
> Fortress-interest mailing list
> Fortress-interest@experimentalstuff.com
> http://www.experimentalstuff.com/mailman/listinfo/fortress-interest



This page is: http://www.experimentalstuff.com/pipermail/fortress-interest/2007-January/000092.html
Last Modified: Tue, 30 Jan 2007 19:35:03 GMT
copyright (c) 2000-2007, Sun Microsystems