This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GSOC | Extending Common Lisp support


On Jun 4, 2012, at 6:56 PM, Charles Turner wrote:

Jamison, that patch fixed the function space lookup issues I was
having, thanks!

Excellent!


But I've been puzzling over a follow-up namespace
related problem. Hopefully with all that information loaded into your
head, you might be able to throw some clues my way :-)

(defun dummy () 'top-level)
(funcall #'dummy) ;=> top-level
(flet ((dummy () 'shadow))
 (funcall #'dummy)) ;=> shadow
(funcall #'dummy) ;=> shadow

Line 1 does a

lexical.push: Declaration[dummy/2]

and when I do a decl.setProcedureDecl(true) on the flet'ed function
line 3, I'm fiddling with a Declaration[dummy/39], so definitely a
different object, and it's in a new scope (a new LetExp), which gets
popped after FLET's extent.

The call to FUNCTION inside the FLET correctly looks up dummy/39, and
outside the FLET, correctly looks up dummy/2, so how is dummy/2's
function binding getting changed? Any clues on where I might find a
smoking gun?

The past few days I've been doing a lot of running with --debug-print- final-expr,
as well as inserting a bunch of Thread.dumpStack()s to see what is calling what.
And of course lots of print statements for variables that might be of interest.


I just whipped up part of a flet implementation and see the same thing you do
when running interactively in the REPL or with -f, but I see correct behavior
when running a file without -f:


$ cat /tmp/flet-test.lisp

(defun funcall (fn &rest args) (display (apply fn args)) (newline))
(defun dummy () 'top-level)
(funcall #'dummy)
(flet ((dummy (lambda () 'shadow)))
  (funcall #'dummy)
(funcall #'dummy)

(Yes, I know that's not standard flet syntax. It does call setProcedureDecl()
though.)


REPL test:

$ kawa --lisp
#|kawa:1|# (load "/tmp/flet-test.lisp")
top-level
shadow
shadow

kawa -f:


$ kawa -f /tmp/flet-test.lisp
top-level
shadow
shadow

kawa without -f:


$ kawa /tmp/flet-test.lisp
top-level
shadow
top-level

Is that consistent with what you're seeing?


Alas, nothing's jumping out at me just yet, but I'll keep looking.

Good thing we've got Charles around to figure everything out for us now!

Can I have his email address? I could use someone like that! :-)

:-)


--
Jamison Hope
The PTR Group
www.theptrgroup.com




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]