<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Kneejerk generic response:<BR>
<BR>
I don't know the operator precedence. Can you put in parens?<BR>
Have you looked at the code?<BR>
Can you mail us a small self contained repro?<BR>
Can you test it on birch?<BR>
(That way -- all your files are there and easily gotten/investigated by others.)<BR>
Optimization enabled? Works without? I know, I shouldn't even ask this sort of thing without evidence.<BR>
<BR>
- Jay<BR> <BR>> To: m3devel@elegosoft.com<BR>> Date: Tue, 16 Jun 2009 00:01:18 -0700<BR>> From: mika@async.caltech.edu<BR>> CC: mika@camembert.async.caltech.edu<BR>> Subject: [M3devel] Strange behavior in recent CM3-compiled code...<BR>> <BR>> <BR>> Hello everyone,<BR>> <BR>> I'm trying to update to the latest CM3 again, so that I can get my<BR>> Mac working, and push my project of migrating a largish codebase<BR>> from PM3 to CM3 a little further.<BR>> <BR>> I updated CM3 today from CVS, on both my Mac and on a FreeBSD system,<BR>> and ... my Scheme interpreter broke. Here's what the code looks like,<BR>> with annotations:<BR>> <BR>> 49 Debug.Out("t.rest = NIL? " & Fmt.Bool(t.rest=NIL));<BR>> 50 Debug.Out("ISTYPE(t.rest,T)? " & Fmt.Bool(ISTYPE(t.rest,T)));<BR>> 51 Debug.Out("Rest(t.rest) = NIL? " & Fmt.Bool(Rest(t.rest)=NIL));<BR>> 52<BR>> 53 IF t.rest # NIL AND ISTYPE(t.rest,T) AND Rest(t.rest) = NIL THEN<BR>> 54 Debug.Out("in IF clause...");<BR>> 55<BR>> 56 IF SymEq(t.first, "quote") THEN special := "'"<BR>> 57 ELSIF SymEq(t.first, "quasiquote") THEN special := "`"<BR>> 58 ELSIF SymEq(t.first, "unquote") THEN special := ","<BR>> 59 ELSIF SymEq(t.first, "unquote-splicing") THEN special := ",@"<BR>> 60 END<BR>> 61 ELSE<BR>> 62 Debug.Out("in ELSE clause...")<BR>> 63 END;<BR>> <BR>> all you need to know is that Debug.Out prints out debugging information<BR>> to the terminal. What I see is...<BR>> <BR>> t.rest = NIL? FALSE<BR>> ISTYPE(t.rest,T)? TRUE<BR>> Rest(t.rest) = NIL? TRUE<BR>> in ELSE clause...<BR>> <BR>> What gives!?<BR>> <BR>> Note this behavior occurs on both the Mac and on FreeBSD4 with a<BR>> compiler and runtime bootstrapped today from some previous CM3.<BR>> My old CM3 compiler was timestamped... April 30, I believe, and the<BR>> code behaved properly under that one.<BR>> <BR>> I believe I have also tried it both with and without compiler<BR>> optimizations.<BR>> <BR>> I find it baffling that so much stuff (mentor!) can work if "AND" isn't<BR>> working right. This is the only if statement in many, many source files<BR>> that seems to be working wrong.<BR>> <BR>> Is it possible I'm missing something?? No I don't think so... here's a more<BR>> explicit version:<BR>> <BR>> Debug.Out("t.rest # NIL? " & Fmt.Bool(t.rest#NIL));<BR>> Debug.Out("ISTYPE(t.rest,T)? " & Fmt.Bool(ISTYPE(t.rest,T)));<BR>> Debug.Out("Rest(t.rest) = NIL? " & Fmt.Bool(Rest(t.rest)=NIL));<BR>> Debug.Out("conjunction? " & Fmt.Bool(<BR>> t.rest # NIL AND ISTYPE(t.rest,T) AND Rest(t.rest) = NIL ));<BR>> IF t.rest # NIL AND ISTYPE(t.rest,T) AND Rest(t.rest) = NIL THEN<BR>> ...<BR>> <BR>> output is:<BR>> <BR>> t.rest # NIL? TRUE<BR>> ISTYPE(t.rest,T)? TRUE<BR>> Rest(t.rest) = NIL? TRUE<BR>> conjunction? FALSE<BR>> in ELSE clause...<BR>> <BR>> TRUE AND TRUE AND TRUE is FALSE??<BR>> <BR>> Note that: <BR>> <BR>> VAR q, w, e := TRUE;<BR>> <BR>> Debug.Out("conjunction? " & Fmt.Bool(<BR>> q AND w AND e));<BR>> <BR>> results in TRUE (as it should).<BR>> <BR>> <BR>> Mika<BR>> <BR></body>
</html>