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 3, 2012, at 11:10 PM, I wrote:

(function x) is still having trouble

The difference here appears to be that in function#rewriteForm(), it creates a ReferenceExp like this:

	    ReferenceExp rexp = new ReferenceExp(name);
	    rexp.setProcedureName(true);
	    rexp.setFlag(ReferenceExp.PREFER_BINDING2);
	    return rexp;

without assigning it a value for its binding. Then FindCapturedVars
comes along and in its visitReferenceExp() does this:

    Declaration decl = exp.getBinding();
    if (decl == null)
      {
	decl = allocUnboundDecl(exp.getSymbol(),
				exp.isProcedureName());
	exp.setBinding(decl);
      }

and then issues the "no declaration seen" warning.

One way to fix this (which ends up fixing my simple test) is to change
function.java to do the lookup:
Declaration decl = tr.lookup(name, Language.FUNCTION_NAMESPACE);
if (decl != null)
{
return new ReferenceExp(name, decl);
}
ReferenceExp rexp = new ReferenceExp(name);
rexp.setProcedureName(true);
...


With that, I no longer get the warning, and moreover (write #'x)
succeeds:

$ kawa /tmp/namespaces.lisp
1
"hello"
#<procedure x>

Is that a valid change to make? I *think* that calling tr.lookup() from within function.rewriteForm() will do the appropriate lexical search, but I'm still a little fuzzy about what's supposed to happen when in the various Syntax methods.

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