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 5, 2012, at 4:56 PM, Charles Turner wrote:

On 5 June 2012 17:47, Jamison Hope <jrh@theptrgroup.com> wrote:
Back through the looking glass. So: what is special about procedure
bindings?

I found a new data point just now, but I'm struggling to see how I can fix the problem with it:

(from kawa-1.12.jar)
#|kawa:1|# (define (myfun) 'outer)
#|kawa:2|# (let ((myfun (lambda () 'inner)))
#|(---:3|#   (myfun))
inner
#|kawa:4|# (myfun)
outer
#|kawa:5|# (apply myfun '())
outer
#|kawa:6|# (let ((myfun (lambda () 'inner)))
#|(---:7|#   (apply myfun '()))
inner
#|kawa:8|# (myfun)
inner
#|kawa:9|# (apply myfun '())
inner

Note that it's the APPLY that clobbers the top-level function binding.
The only thing I can see that is different with these two approaches
comes from CallContext#runUnitlDone, the:

Procedure proc = this.proc
...
this.proc = null
proc.apply(this)

When (myfun) is the body of the let, <procedure myfun> is does not go
through the above operations and all is good. My (apply myfun '()) is
the body of the let, <procedure myfun> *does* go through the above
operations (that is, this.proc = null followed by proc.apply), and it
*does* clobber the top-level binding. I'm stuggling to see where this
clobbering is happening though!

I'll continue scratching my head, just thought that was an interesting
data point.

Good catch! I also saw it with (display myfun), so it looks like it's not APPLY per se, but rather any reference to myfun as an argument to another function.

Still confused though.

-J


Charles.

-- 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]