<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
So..I have m3back using Target.Int a bunch.<BR>
And converting back and forth some between Target.Int and<BR>
INTEGER and doing match with Target.Int.<BR>
And various operations can fail.<BR>
<BR>
<BR>
And my current diff results in:<BR>
<BR>
<BR>
new source -> compiling Lex.m3 <BR> "..\src\fmtlex\Lex.m3", line 227: doneg: Negate overflowed <BR> "..\src\fmtlex\Lex.m3", line 343: doneg: Negate overflowed <BR> 2 errors encountered <BR> new source -> compiling Scan.i3 <BR>
<BR>
<BR>
which is nice to see, it means my code is actually running. <BR>
<BR>
<BR>
So I look at the code in question: <BR>
<BR>
<BR>
PROCEDURE ReadNumber(rd: Rd.T; defaultBase: [2..16]; signed: BOOLEAN): Word.T <BR> VAR c: CHAR; sign: [0..1]; res: Word.T; BEGIN <BR>...<BR>
IF signed AND<BR> ((sign = 0 AND Word.GT(res, LAST(INTEGER))) OR<BR> (sign = 1 AND Word.GT(res, -FIRST(INTEGER)))) THEN<BR> RAISE FloatMode.Trap(FloatMode.Flag.IntOverflow)<BR>....<BR>
<BR>
<BR>
-FIRST(INTEGER).<BR>
<BR>
<BR>
What is that supposed to do?<BR>
<BR>
<BR>
I mean, I kind of know, I'm slightly playing stupid, partly not.<BR>
Does the compiler know what is an INTEGER vs. what is a "Word"?<BR>
Or it is just obligated to assume everything is a Word?<BR>
To do the negation at compile time and ignore the overflow?<BR>
<BR>
<BR>
Does the language need work here?<BR>
I mean, like, -FIRST(INTEGER), that is a problematic expression, isn't it?<BR>
<BR>
<BR>
- Jay<BR>
<BR> </body>
</html>