Source reading questions.

Per Bothner per@bothner.com
Thu Apr 5 19:24:00 GMT 2012


On 04/05/2012 11:15 AM, Jamison Hope wrote:
> On Apr 5, 2012, at 1:09 PM, Necto wrote:
>
>> Hello, everyone!
>>
>> I'm a new in the project.
>
> Welcome Necto!
>
>> I'm trying to understand an internal
>> mechanics of the compiler. So it rises a first, simple question:
>>
>> What does gnu.expr.SetExp.PREFER_BINDING2 mean?

Actually, you just found a buglet.

> Judging from the results of a quick grep, it looks like it's related
> to Kawa's implementation of separate namespaces for functions and
> variables (i.e. Lisp-2). But, it doesn't look like SetExp.PREFER_BINDING2
> is ever used (it's set once in setq.java, but nothing ever checks it,
> as far as I can tell), unlike ReferenceExp.PREFER_BINDING2, which shows
> up in more places. My guess would be that it's either obsolete, with its
> intended functionality being implemented in another way, or that it's
> just incomplete because it wasn't needed for Scheme and fell to the back
> of Per's feature priority queue.
>
> Let's see if Per can remember all the way back to r1720 (twelve years
> ago!) when he added that flag to give us more details....

I can't say my memory is *that* good!

SetExp.PREFER_BINDING2 does seem rather broken.

First, it should probably be combined with ReferenceExp.PREFER_BINDING2
by moving it to the common super-class AccessExp.

Second, it is set in setq but never used - which is good because it
shouldn't be set in setq, since setq sets the value binding, not
the function binding.

I just checked in fixes for both problems, and added a comment
for the new AccessExp.PREFER_BINDING2.

To set the function binding you can use the (unimplemented) setf form:

(setf (function foo) (function bar))
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Kawa mailing list