<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'">Yes, I agree. I am now convinced that relaxing the current spec to allow assignability and mixed operand arithmetic is a swamp that we should steer well clear of.</font></span></div></span></span></span></span></span></span></span></span></div></span></span>
</div>
<br><div><div>On 11 Jan 2010, at 19:45, Rodney M. Bates wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br><br>Tony Hosking wrote:<br><blockquote type="cite">One thing I've really struggled with over the introduction of LONGINT is the need for distinct literal forms. This strikes me as odd, since literals are really just ways of writing values, rather than stating anything about how they should be represented.<br></blockquote><blockquote type="cite">(Yes, I know that the REAL/LONGREAL/EXTENDED literals are all distinct, but they really do have incompatible value representations).<br></blockquote><br>I agree, the need for distinctly typed literals is much greater for the<br>floating types than the integer types, because they can't be viewed<br>as having overlapping value sets in any reasonable way.<br><br><blockquote type="cite">It strikes me that with checked assignability for INTEGER/LONGINT we could also potentially treat integer literals as essentially "untyped" (neither INTEGER nor LONGINT). (I still strongly resist going the route of having mixed type operands for arithmetic...)<br></blockquote><blockquote type="cite">Here's how things would work with subrange types.<br></blockquote><blockquote type="cite">A subrange written as currently<br></blockquote><blockquote type="cite">[lo .. hi]<br></blockquote><blockquote type="cite">would by default be assumed to have base type INTEGER. The constants lo/hi must both be in range for INTEGER.<br></blockquote><blockquote type="cite">A subrange with base type LONGINT would be written explicitly:<br></blockquote><blockquote type="cite">[lo .. hi] OF LONGINT<br></blockquote><blockquote type="cite">The constants lo/hi must both be in range for LONGINT.<br></blockquote><blockquote type="cite">We could also support the form:<br></blockquote><blockquote type="cite">[lo .. hi] OF INTEGER<br></blockquote><blockquote type="cite">just for consistency though the "OF INTEGER" qualification would be unnecessarily verbose.<br></blockquote><blockquote type="cite">Here we are allowing the programmer to state explicitly what the base type of the subrange should be.<br></blockquote><br>This would eliminate _one_ reason for needing distinct integer literals.<br><br><blockquote type="cite">Literals would be be range-checked when used as arithmetic operands or in assignment, with compile-time checks that they are in range ("compatible") with the types of the other operands or the destination of the assignment.<br></blockquote><br>The reason I proposed the distinct literals is because of feeling very<br>badly burned by Ada. It has a type "universal integer", which is builtin,<br>and all integer literals have this type. They have unbounded range and<br>a complete set of arithmetic operators, which can only be evaluated at<br>compile time. The type "universal integer" can't be named in source<br>code.<br><br>The rules for when they are converted to a type having a runtime representation<br>are complicated, messy, highly surprising, and a huge complication of the<br>language. Static type information can propagate a long way through<br>language constructs. The programmer's dilemma in figuring out just what<br>is happening is much worse than arithmetic operators that accept mixed<br>sizes and do the computation in the larger size.<br><br>Maybe the semantics of this idea could be done better than in Ada, but I spent<br>a lot of time trying, and didn't come up with anything that wasn't both too<br>complicated and not worth the gain, IMO.<br><br>We should come up with a complete language proposal before going this way.<br><br><br><br><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></div></blockquote></div><br></body></html>