<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><font class="Apple-style-span" color="#0000FF" face="'Gill Sans'"><span class="Apple-style-span" style="font-size: medium;">To summarise the discussion so far...</span></font></div></span></span></span></span></span></span></span></span></div></span></span>
</div><div><br class="webkit-block-placeholder"></div><div>1. Do we really need LONGINT? Some have expressed a desire for it. The only use-case so far is large file sizes.</div><div><br></div><div>2. If we do need LONGINT then Rodney's proposal seems sound apart from the question of resolution of the builtin overloaded arithmetic operators. Rodney's proposal is that they resolve to the maximal type of their operands. Jay, I am very concerned about your definitions for MOD/DIV below because I think they are inherently unintuitive (witness your own claims of "subtlety" -- Modula-3 should not ever have subtle semantics!). I forget what the rules for C happen to be... (with good reason since I've never wanted to try to remember them and avoid mixed type operands like the plague!). So, do I hear strong arguments for or against mixed type integer operands?</div>
<br><div><div>On 8 Jan 2010, at 12:33, Rodney M. Bates wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br><br>Jay K wrote:<br><blockquote type="cite">This simple diff in the front end allows the "obvious" mixing of INTEGER and LONGINT without any need for ORD or VAL.<br></blockquote><blockquote type="cite"> LONGINT + INTEGER => LONGINT<br></blockquote><blockquote type="cite"> LONGINT - INTEGER => LONGINT<br></blockquote><blockquote type="cite"> LONGINT * INTEGER => LONGINT<br></blockquote><blockquote type="cite"> LONGINT DIV INTEGER => LONGINT<br></blockquote><blockquote type="cite"> INTEGER DIV LONGINT => LONGINT (subtle and I think incorrect, should be INTEGER)<br></blockquote><blockquote type="cite"> INTEGER MOD LONGINT => INTEGER (subtle but I believe correct) LONGINT MOD INTEGER => INTEGER (subtle but I believe correct) MIN(INTEGER, LONGINT) => LONGINT (This is wrong actually, should be INTEGER) MAX(INTEGER, LONGINT) => LONGINT LONGINT := INTEGER<br></blockquote><br>Making INTEGER and LONGINT mutually assignable (or even one-way<br>assignability of INTEGER to LONGINT) implies all of the above.<br>The arithmetic operators are defined as generalizations of Modula-3<br>procedures, with parameters of VALUE mode. And the rule for VALUE<br>requires only that the actual be assignable to the formal, not<br>have identical type. This is what I originally proposed.<br><br>Actually, with LONGINT in the picture, the arithmetic operators have<br>to be defined more carefully, in order to avoid or remove ambiguity in<br>resolution of builtin overloaded arithmetic operators. Particularly,<br>we have to eliminate the possibility that, e.g., an expression of the form<br>INTEGER <op> INTEGER would resolve to the LONGINT <op> LONGINT -> LONGINT<br>operator, by assignability of INTEGER to LONGINT. This would completely<br>the efficiency of native machine arithmetic.<br><br>Whatever we do, I feel very strongly that we should preserve consistency<br>with both the existing rules that assignment statements and passing<br>VALUE parameters require assignability. That means that explicitly coded<br>VAL/ORD functions will be required either in both assignments and mixed<br>arithmetic, or neither. The same applies to a number of other places<br>that require assignability.<br><br><br><blockquote type="cite"> Other mixes are less obvious and would require runtime checks.<br></blockquote><blockquote type="cite"> I think the backend will just work but I haven't tried that yet.<br></blockquote><blockquote type="cite"> (Truth be told, I can only affectively edit files on NT...)<br></blockquote><blockquote type="cite"> Thoughts?<br></blockquote><blockquote type="cite"> - Jay<br></blockquote><blockquote type="cite"> Index: builtinOps/Dec.m3<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/Dec.m3,v<br></blockquote><blockquote type="cite">retrieving revision 1.9<br></blockquote><blockquote type="cite">diff -u -r1.9 Dec.m3<br></blockquote><blockquote type="cite">--- builtinOps/Dec.m3 25 Sep 2009 02:42:10 -0000 1.9<br></blockquote><blockquote type="cite">+++ builtinOps/Dec.m3 8 Jan 2010 07:35:43 -0000<br></blockquote><blockquote type="cite">@@ -44,7 +44,7 @@<br></blockquote><blockquote type="cite"> IF (NUMBER (ce.args^) > 1) THEN<br></blockquote><blockquote type="cite"> IF Type.IsSubtype (t, LInt.T) THEN<br></blockquote><blockquote type="cite"> t := Type.Base (Expr.TypeOf (ce.args[1]));<br></blockquote><blockquote type="cite">- IF (t # LInt.T) THEN<br></blockquote><blockquote type="cite">+ IF t # LInt.T AND t # Int.T THEN<br></blockquote><blockquote type="cite"> Error.Txt (name, "second argument must be a LONGINT");<br></blockquote><blockquote type="cite"> END;<br></blockquote><blockquote type="cite"> ELSE<br></blockquote><blockquote type="cite">Index: builtinOps/Max.m3<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/Max.m3,v<br></blockquote><blockquote type="cite">retrieving revision 1.3<br></blockquote><blockquote type="cite">diff -u -r1.3 Max.m3<br></blockquote><blockquote type="cite">--- builtinOps/Max.m3 18 Sep 2007 20:25:36 -0000 1.3<br></blockquote><blockquote type="cite">+++ builtinOps/Max.m3 8 Jan 2010 07:35:43 -0000<br></blockquote><blockquote type="cite">@@ -25,11 +25,14 @@<br></blockquote><blockquote type="cite"> PROCEDURE DoCheck (name: TEXT; ce: CallExpr.T) =<br></blockquote><blockquote type="cite"> VAR ta, tb: Type.T;<br></blockquote><blockquote type="cite">+ resultType: Type.T := NIL;<br></blockquote><blockquote type="cite"> BEGIN<br></blockquote><blockquote type="cite"> ta := Type.Base (Expr.TypeOf (ce.args[0]));<br></blockquote><blockquote type="cite"> tb := Type.Base (Expr.TypeOf (ce.args[1]));<br></blockquote><blockquote type="cite"> - IF (NOT Type.IsEqual (ta, tb, NIL)) THEN<br></blockquote><blockquote type="cite">+ IF (ta = LInt.T AND tb = Int.T) OR (tb = LInt.T AND ta = Int.T) THEN<br></blockquote><blockquote type="cite">+ resultType := LInt.T;<br></blockquote><blockquote type="cite">+ ELSIF (NOT Type.IsEqual (ta, tb, NIL)) THEN<br></blockquote><blockquote type="cite"> Error.Txt (name, "incompatible argument types");<br></blockquote><blockquote type="cite"> ELSIF (ta = Int.T) OR (ta = LInt.T) OR (Type.IsOrdinal (ta)) THEN<br></blockquote><blockquote type="cite"> (* ok *)<br></blockquote><blockquote type="cite">@@ -39,7 +42,11 @@<br></blockquote><blockquote type="cite"> Error.Txt (name, "wrong argument types");<br></blockquote><blockquote type="cite"> ta := Int.T;<br></blockquote><blockquote type="cite"> END;<br></blockquote><blockquote type="cite">- ce.type := ta;<br></blockquote><blockquote type="cite">+ IF resultType # NIL THEN<br></blockquote><blockquote type="cite">+ ce.type := resultType;<br></blockquote><blockquote type="cite">+ ELSE<br></blockquote><blockquote type="cite">+ ce.type := ta;<br></blockquote><blockquote type="cite">+ END;<br></blockquote><blockquote type="cite"> END DoCheck;<br></blockquote><blockquote type="cite"> PROCEDURE Compile (ce: CallExpr.T) =<br></blockquote><blockquote type="cite">Index: exprs/AddExpr.m3<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/AddExpr.m3,v<br></blockquote><blockquote type="cite">retrieving revision 1.3<br></blockquote><blockquote type="cite">diff -u -r1.3 AddExpr.m3<br></blockquote><blockquote type="cite">--- exprs/AddExpr.m3 4 May 2008 11:03:45 -0000 1.3<br></blockquote><blockquote type="cite">+++ exprs/AddExpr.m3 8 Jan 2010 07:35:43 -0000<br></blockquote><blockquote type="cite">@@ -67,6 +67,7 @@<br></blockquote><blockquote type="cite"> PROCEDURE Check (p: P; VAR cs: Expr.CheckState) =<br></blockquote><blockquote type="cite"> VAR ta, tb, range: Type.T;<br></blockquote><blockquote type="cite">+ resultType: Type.T := NIL;<br></blockquote><blockquote type="cite"> BEGIN<br></blockquote><blockquote type="cite"> Expr.TypeCheck (p.a, cs);<br></blockquote><blockquote type="cite"> Expr.TypeCheck (p.b, cs);<br></blockquote><blockquote type="cite">@@ -74,8 +75,9 @@<br></blockquote><blockquote type="cite"> tb := Type.Base (Expr.TypeOf (p.b));<br></blockquote><blockquote type="cite"> IF (ta = Int.T) AND (tb = Int.T) THEN<br></blockquote><blockquote type="cite"> p.class := Class.cINT;<br></blockquote><blockquote type="cite">- ELSIF (ta = LInt.T) AND (tb = LInt.T) THEN<br></blockquote><blockquote type="cite">- p.class := Class.cLINT<br></blockquote><blockquote type="cite">+ ELSIF (ta = LInt.T OR ta = Int.T) AND (tb = LInt.T OR tb = Int.T) THEN<br></blockquote><blockquote type="cite">+ p.class := Class.cLINT;<br></blockquote><blockquote type="cite">+ resultType := LInt.T;<br></blockquote><blockquote type="cite"> ELSIF (ta = Reel.T) AND (tb = Reel.T) THEN<br></blockquote><blockquote type="cite"> p.class := Class.cREAL;<br></blockquote><blockquote type="cite"> ELSIF (ta = LReel.T) AND (tb = LReel.T) THEN<br></blockquote><blockquote type="cite">@@ -96,7 +98,11 @@<br></blockquote><blockquote type="cite"> ELSE<br></blockquote><blockquote type="cite"> ta := Expr.BadOperands ("\'+\'", ta, tb);<br></blockquote><blockquote type="cite"> END;<br></blockquote><blockquote type="cite">- p.type := ta;<br></blockquote><blockquote type="cite">+ IF resultType # NIL THEN<br></blockquote><blockquote type="cite">+ p.type := resultType;<br></blockquote><blockquote type="cite">+ ELSE<br></blockquote><blockquote type="cite">+ p.type := ta;<br></blockquote><blockquote type="cite">+ END;<br></blockquote><blockquote type="cite"> END Check;<br></blockquote><blockquote type="cite"> PROCEDURE Prep (p: P) =<br></blockquote><blockquote type="cite">Index: exprs/DivExpr.m3<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/DivExpr.m3,v<br></blockquote><blockquote type="cite">retrieving revision 1.5<br></blockquote><blockquote type="cite">diff -u -r1.5 DivExpr.m3<br></blockquote><blockquote type="cite">--- exprs/DivExpr.m3 4 May 2008 11:03:46 -0000 1.5<br></blockquote><blockquote type="cite">+++ exprs/DivExpr.m3 8 Jan 2010 07:35:43 -0000<br></blockquote><blockquote type="cite">@@ -60,7 +60,7 @@<br></blockquote><blockquote type="cite"> tb := Type.Base (Expr.TypeOf (p.b));<br></blockquote><blockquote type="cite"> IF (ta = Int.T) AND (tb = Int.T) THEN<br></blockquote><blockquote type="cite"> p.type := Int.T;<br></blockquote><blockquote type="cite">- ELSIF (ta = LInt.T) AND (tb = LInt.T) THEN<br></blockquote><blockquote type="cite">+ ELSIF (ta = LInt.T OR ta = Int.T) AND (tb = LInt.T OR tb = Int.T) THEN<br></blockquote><blockquote type="cite"> p.type := LInt.T;<br></blockquote><blockquote type="cite"> ELSE<br></blockquote><blockquote type="cite"> p.type := Expr.BadOperands ("DIV", ta, tb);<br></blockquote><blockquote type="cite">Index: exprs/ModExpr.m3<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/ModExpr.m3,v<br></blockquote><blockquote type="cite">retrieving revision 1.5<br></blockquote><blockquote type="cite">diff -u -r1.5 ModExpr.m3<br></blockquote><blockquote type="cite">--- exprs/ModExpr.m3 4 May 2008 11:03:46 -0000 1.5<br></blockquote><blockquote type="cite">+++ exprs/ModExpr.m3 8 Jan 2010 07:35:43 -0000<br></blockquote><blockquote type="cite">@@ -60,6 +60,7 @@<br></blockquote><blockquote type="cite"> PROCEDURE Check (p: P; VAR cs: Expr.CheckState) =<br></blockquote><blockquote type="cite"> VAR ta, tb: Type.T;<br></blockquote><blockquote type="cite">+ resultType: Type.T := NIL;<br></blockquote><blockquote type="cite"> BEGIN<br></blockquote><blockquote type="cite"> Expr.TypeCheck (p.a, cs);<br></blockquote><blockquote type="cite"> Expr.TypeCheck (p.b, cs);<br></blockquote><blockquote type="cite">@@ -67,8 +68,18 @@<br></blockquote><blockquote type="cite"> tb := Type.Base (Expr.TypeOf (p.b));<br></blockquote><blockquote type="cite"> IF (ta = Int.T) AND (tb = Int.T) THEN<br></blockquote><blockquote type="cite"> p.class := Class.cINT;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite"> ELSIF (ta = LInt.T) AND (tb = LInt.T) THEN<br></blockquote><blockquote type="cite"> p.class := Class.cLINT;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ (* The result of MOD cannot be higher than either of its inputs.<br></blockquote><blockquote type="cite">+ * small divided by big is 0 remainder small<br></blockquote><blockquote type="cite">+ * big divided by small has a remainder of at most small<br></blockquote><blockquote type="cite">+ *)<br></blockquote><blockquote type="cite">+ ELSIF (ta = LInt.T OR ta = Int.T) AND (tb = LInt.T OR tb = Int.T) THEN<br></blockquote><blockquote type="cite">+ p.class := Class.cINT;<br></blockquote><blockquote type="cite">+ resultType := Int.T;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite"> ELSIF (ta = Reel.T) AND (tb = Reel.T) THEN<br></blockquote><blockquote type="cite"> p.class := Class.cREAL;<br></blockquote><blockquote type="cite"> ELSIF (ta = LReel.T) AND (tb = LReel.T) THEN<br></blockquote><blockquote type="cite">@@ -78,7 +89,11 @@<br></blockquote><blockquote type="cite"> ELSE p.class := Class.cERR; ta := Int.T;<br></blockquote><blockquote type="cite"> ta := Expr.BadOperands ("MOD", ta, tb);<br></blockquote><blockquote type="cite"> END;<br></blockquote><blockquote type="cite">- p.type := ta;<br></blockquote><blockquote type="cite">+ IF resultType # NIL THEN<br></blockquote><blockquote type="cite">+ p.type := resultType;<br></blockquote><blockquote type="cite">+ ELSE<br></blockquote><blockquote type="cite">+ p.type := ta;<br></blockquote><blockquote type="cite">+ END;<br></blockquote><blockquote type="cite"> END Check;<br></blockquote><blockquote type="cite"> PROCEDURE Prep (p: P) =<br></blockquote><blockquote type="cite">Index: exprs/MultiplyExpr.m3<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/MultiplyExpr.m3,v<br></blockquote><blockquote type="cite">retrieving revision 1.3<br></blockquote><blockquote type="cite">diff -u -r1.3 MultiplyExpr.m3<br></blockquote><blockquote type="cite">--- exprs/MultiplyExpr.m3 4 May 2008 11:03:46 -0000 1.3<br></blockquote><blockquote type="cite">+++ exprs/MultiplyExpr.m3 8 Jan 2010 07:35:43 -0000<br></blockquote><blockquote type="cite">@@ -66,6 +66,7 @@<br></blockquote><blockquote type="cite"> PROCEDURE Check (p: P; VAR cs: Expr.CheckState) =<br></blockquote><blockquote type="cite"> VAR ta, tb, range: Type.T;<br></blockquote><blockquote type="cite">+ resultType: Type.T := NIL;<br></blockquote><blockquote type="cite"> BEGIN<br></blockquote><blockquote type="cite"> Expr.TypeCheck (p.a, cs);<br></blockquote><blockquote type="cite"> Expr.TypeCheck (p.b, cs);<br></blockquote><blockquote type="cite">@@ -73,8 +74,9 @@<br></blockquote><blockquote type="cite"> tb := Type.Base (Expr.TypeOf (p.b));<br></blockquote><blockquote type="cite"> IF (tb = Int.T) AND (ta = Int.T) THEN<br></blockquote><blockquote type="cite"> p.class := cINT;<br></blockquote><blockquote type="cite">- ELSIF (tb = LInt.T) AND (ta = LInt.T) THEN<br></blockquote><blockquote type="cite">+ ELSIF (ta = LInt.T OR ta = Int.T) AND (tb = LInt.T OR tb = Int.T) THEN<br></blockquote><blockquote type="cite"> p.class := cLINT;<br></blockquote><blockquote type="cite">+ resultType := LInt.T;<br></blockquote><blockquote type="cite"> ELSIF (tb = Reel.T) AND (ta = Reel.T) THEN<br></blockquote><blockquote type="cite"> p.class := cREAL;<br></blockquote><blockquote type="cite"> ELSIF (tb = LReel.T) AND (ta = LReel.T) THEN<br></blockquote><blockquote type="cite">@@ -90,7 +92,11 @@<br></blockquote><blockquote type="cite"> ta := Expr.BadOperands ("\'*\'", ta, tb);<br></blockquote><blockquote type="cite"> p.class := cINT;<br></blockquote><blockquote type="cite"> END;<br></blockquote><blockquote type="cite">- p.type := ta;<br></blockquote><blockquote type="cite">+ IF resultType # NIL THEN<br></blockquote><blockquote type="cite">+ p.type := resultType;<br></blockquote><blockquote type="cite">+ ELSE<br></blockquote><blockquote type="cite">+ p.type := ta;<br></blockquote><blockquote type="cite">+ END;<br></blockquote><blockquote type="cite"> END Check;<br></blockquote><blockquote type="cite"> PROCEDURE Prep (p: P) =<br></blockquote><blockquote type="cite">Index: exprs/SubtractExpr.m3<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/SubtractExpr.m3,v<br></blockquote><blockquote type="cite">retrieving revision 1.4<br></blockquote><blockquote type="cite">diff -u -r1.4 SubtractExpr.m3<br></blockquote><blockquote type="cite">--- exprs/SubtractExpr.m3 4 May 2008 11:03:46 -0000 1.4<br></blockquote><blockquote type="cite">+++ exprs/SubtractExpr.m3 8 Jan 2010 07:35:43 -0000<br></blockquote><blockquote type="cite">@@ -73,6 +73,7 @@<br></blockquote><blockquote type="cite"> PROCEDURE Check (p: P; VAR cs: Expr.CheckState) =<br></blockquote><blockquote type="cite"> VAR ta, tb, range: Type.T;<br></blockquote><blockquote type="cite">+ resultType: Type.T := NIL;<br></blockquote><blockquote type="cite"> BEGIN<br></blockquote><blockquote type="cite"> Expr.TypeCheck (p.a, cs);<br></blockquote><blockquote type="cite"> Expr.TypeCheck (p.b, cs);<br></blockquote><blockquote type="cite">@@ -80,8 +81,9 @@<br></blockquote><blockquote type="cite"> tb := Type.Base (Expr.TypeOf (p.b));<br></blockquote><blockquote type="cite"> IF (ta = Int.T) AND (tb = Int.T) THEN<br></blockquote><blockquote type="cite"> p.class := Class.cINT;<br></blockquote><blockquote type="cite">- ELSIF (ta = LInt.T) AND (tb = LInt.T) THEN<br></blockquote><blockquote type="cite">+ ELSIF (ta = LInt.T OR ta = Int.T) AND (tb = LInt.T OR tb = Int.T) THEN<br></blockquote><blockquote type="cite"> p.class := Class.cLINT;<br></blockquote><blockquote type="cite">+ resultType := LInt.T;<br></blockquote><blockquote type="cite"> ELSIF (ta = Reel.T) AND (tb = Reel.T) THEN<br></blockquote><blockquote type="cite"> p.class := Class.cREAL;<br></blockquote><blockquote type="cite"> ELSIF (ta = LReel.T) AND (tb = LReel.T) THEN<br></blockquote><blockquote type="cite">@@ -113,7 +115,11 @@<br></blockquote><blockquote type="cite"> ta := Expr.BadOperands ("\'-\'", ta, tb);<br></blockquote><blockquote type="cite"> p.class := Class.cINT;<br></blockquote><blockquote type="cite"> END;<br></blockquote><blockquote type="cite">- p.type := ta;<br></blockquote><blockquote type="cite">+ IF resultType # NIL THEN<br></blockquote><blockquote type="cite">+ p.type := resultType;<br></blockquote><blockquote type="cite">+ ELSE<br></blockquote><blockquote type="cite">+ p.type := ta;<br></blockquote><blockquote type="cite">+ END;<br></blockquote><blockquote type="cite"> END Check;<br></blockquote><blockquote type="cite"> PROCEDURE Prep (p: P) =<br></blockquote><blockquote type="cite">Index: types/Type.m3<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">RCS file: /usr/cvs/cm3/m3-sys/m3front/src/types/Type.m3,v<br></blockquote><blockquote type="cite">retrieving revision 1.8<br></blockquote><blockquote type="cite">diff -u -r1.8 Type.m3<br></blockquote><blockquote type="cite">--- types/Type.m3 4 May 2008 11:03:49 -0000 1.8<br></blockquote><blockquote type="cite">+++ types/Type.m3 8 Jan 2010 07:35:43 -0000<br></blockquote><blockquote type="cite">@@ -543,6 +543,10 @@<br></blockquote><blockquote type="cite"> IF IsEqual (a, b, NIL) OR IsSubtype (b, a) THEN<br></blockquote><blockquote type="cite"> RETURN TRUE;<br></blockquote><blockquote type="cite"> ELSIF IsOrdinal (a) THEN<br></blockquote><blockquote type="cite">+ (* INTEGER is assignable to LONGINT *)<br></blockquote><blockquote type="cite">+ IF a = LInt.T AND b = Int.T THEN<br></blockquote><blockquote type="cite">+ RETURN TRUE;<br></blockquote><blockquote type="cite">+ END;<br></blockquote><blockquote type="cite"> (* ordinal types: OK if there is a common supertype<br></blockquote><blockquote type="cite"> and they have at least one member in common. *)<br></blockquote><blockquote type="cite"> IF IsEqual (Base(a), Base(b), NIL)<br></blockquote></div></blockquote></div><br></body></html>