<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><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#0000FF" face="'Gill Sans'">Aha! Thanks Rodney. Do we have any use-cases for LONGCARD?</font></span></div></span></span></span></span></span></span></span></span></div></span></span></div>
<br><div><div>On 17 Dec 2009, at 10:08, Rodney M. Bates wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br><br>Tony Hosking wrote:<br><blockquote type="cite">This does not make sense:<br></blockquote><blockquote type="cite">Here is the compiler's definition of the builtin CARDINAL type:<br></blockquote><blockquote type="cite">MODULE Card;<br></blockquote><blockquote type="cite">IMPORT SubrangeType, Target, TInt, Tipe, Int;<br></blockquote><blockquote type="cite">PROCEDURE Initialize () =<br></blockquote><blockquote type="cite"> BEGIN<br></blockquote><blockquote type="cite"> T := SubrangeType.New (TInt.Zero, Target.Integer.max, Int.T, TRUE);<br></blockquote><br>CARDINAL is builtin -----------------------------------------------^<br><br><blockquote type="cite"> Tipe.Define ("CARDINAL", T, TRUE);<br></blockquote><blockquote type="cite"> END Initialize;<br></blockquote><blockquote type="cite">BEGIN<br></blockquote><blockquote type="cite">END Card.<br></blockquote><blockquote type="cite">Notice that it is a subrange type [0..LAST(INTEGER)].<br></blockquote><blockquote type="cite">Antony Hosking | Associate Professor | Computer Science | Purdue University<br></blockquote><blockquote type="cite">305 N. University Street | West Lafayette | IN 47907 | USA<br></blockquote><blockquote type="cite">Office +1 765 494 6001 | Mobile +1 765 427 5484<br></blockquote><br>And from MODULE SubrangeType:<br><br>....<br><br>PROCEDURE EqualChk (a: P; t: Type.T; x: Type.Assumption): BOOLEAN =<br> VAR b: P := t;<br> BEGIN<br> Seal (a); Seal (b);<br> RETURN (a.builtin = b.builtin)<br><br> ^ --- builtin property must be the same for type equality<br><br> AND TInt.EQ (a.min, b.min)<br> AND TInt.EQ (a.max, b.max)<br> AND Type.IsEqual (a.baseType, b.baseType, x);<br> END EqualChk;<br><br>...<br><br>PROCEDURE Parse (): Type.T =<br> TYPE TK = Token.T;<br> VAR p: P := New (TInt.Zero, TInt.MOne, NIL, FALSE);<br><br>Programmer-defined subrange is not builtin -- ^<br><br> BEGIN<br> Match (TK.tLBRACKET);<br> p.minE := Expr.Parse ();<br> Match (TK.tDOTDOT);<br> p.maxE := Expr.Parse ();<br> Match (TK.tRBRACKET);<br> RETURN p;<br> END Parse;<br><br>This program:<br><br>MODULE Card EXPORTS Main<br><br>; TYPE C = CARDINAL<br>; TYPE D = [ 0 .. LAST ( INTEGER ) ]<br><br>; PROCEDURE DP ( VAR DPF : D )<br> = BEGIN<br> DPF := 0<br> END DP<br>; PROCEDURE CP ( VAR CPF : C )<br> = BEGIN<br> CPF := 0<br> END CP<br><br>; PROCEDURE Try ( )<br> = VAR CV : C<br> ; VAR DV : D<br> ; BEGIN<br> CP ( CV )<br> ; CP ( DV ) <--- line 20<br> ; DP ( CV )<br> ; DP ( DV )<br> END Try<br><br>; BEGIN<br> Try ( )<br> END Card<br></div></blockquote></div><br></body></html>