<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<div>Hi dear devs,</div><div><br></div><div>I encountered some funny behaviour between compiled and interpreted</div><div>code with flet. I'm not sure if this is a duplicate bug?</div><div><br></div><div>-------- flet-bug.lisp --------------</div><div><br></div><div>(defun foo (x)</div><div> (print x))</div><div><br></div><div>(defun test1 ()</div><div> (flet ((foo1 ()</div><div> (foo 3)))</div><div> (foo1)))</div><div><br></div><div>(defun test2 ()</div><div> (flet ((foo ()</div><div> (foo 3)))</div><div> (foo)))</div><div><br></div><div>------------------------------------</div><div><br></div><div>We compile the following file,</div><div><br></div><div> (compile-file "c:/me/temp/flet-bug.lisp")</div><div> ; Compiling C:/me/temp/flet-bug.lisp ...</div><div><br></div><div> ; (DEFUN FOO ...)</div><div><br></div><div> ; (DEFUN TEST1 ...)</div><div><br></div><div> ; (DEFUN TEST2 ...)</div><div><br></div><div> ; Wrote c:/me/temp/flet-bug.abcl (2.62 seconds)</div><div><br></div><div><br></div><div>Then either load it interpreted or compiled. Interpreted, everything's</div><div>fine:</div><div><br></div><div> > (load "c:/me/temp/flet-bug.lisp")</div><div> T</div><div> > (test1)</div><div> </div><div><br></div><div> 3 </div><div><br></div><div> 3</div><div> > (test2)</div><div> </div><div><br></div><div> 3 </div><div><br></div><div> 3</div><div><br></div><div>Compiled, we get an error in test2:</div><div><br></div><div> > (load "c:/me/temp/flet-bug.abcl")</div><div> T</div><div> > (test1)</div><div> </div><div><br></div><div> 3 </div><div><br></div><div> 3</div><div> > (test2)</div><div> ; Evaluation aborted on #<PROGRAM-ERROR {797E7B}>.</div><div><br></div><div><br></div><div>The stack trace for this is:</div><div><br></div><div> Wrong number of arguments for #<FOO {CCA5B9}>.</div><div> [Condition of type PROGRAM-ERROR]</div><div> </div><div> Restarts:</div><div> 0: [RETRY] Retry SLIME REPL evaluation request.</div><div> 1: [*ABORT] Return to SLIME's top level.</div><div> 2: [ABORT] Abort thread.</div><div> </div><div> Backtrace:</div><div> 0: (#<FUNCTION {490A12}> #<PROGRAM-ERROR {19430CA}> #<FUNCTION {490A12}>)</div><div> 1: (APPLY #<FUNCTION {490A12}> (#<PROGRAM-ERROR {19430CA}> #<FUNCTION {490A12}>))</div><div> 2: (SYSTEM::RUN-HOOK SYSTEM::*INVOKE-DEBUGGER-HOOK* #<PROGRAM-ERROR {19430CA}> #<FUNCTION {490A12}>)</div><div> 3: (INVOKE-DEBUGGER #<PROGRAM-ERROR {19430CA}>)</div><div> 4: org.armedbear.lisp.Lisp.error(Lisp.java:381)</div><div> 5: org.armedbear.lisp.Function.execute(Function.java:312)</div><div> 6: org.armedbear.lisp.Primitive.execute(Primitive.java:113)</div><div> 7: (FOO 3)</div><div> 8: (TEST2)</div><div> 9: (SYSTEM::%EVAL (TEST2))</div><div> 10: (EVAL (TEST2))</div><div> 11: (SWANK::EVAL-REGION "(test2)</div><div><br></div><div> ")</div><div> ... etc ...</div><div><br></div><div><br></div><div>Thanks for your attention,</div><div><br></div><div>Wei-Lun Chiu</div> </div></body>
</html>