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] Parameter protocols in CL


On 18 July 2012 00:04, Per Bothner <per@bothner.com> wrote:
> Try not to get bogged down into this.  The apply methods are also
> likely to change for various reasons.  So just try to translate
> the Common Lisp forms into whatever LambdaExp forms that Scheme
> would.  Don't try to add to or enhance the parameter handling: It's
> complicated, and it may change soon.

I'm not sure what you mean by just translating to LambdaExp. The other
parameter feature missing is the ability to have a keyword name not be
a keyword symbol, i.e. (&key ((:keyname some-other-symname) dflt)).
That appears to need new plumbing in the code generator. There's also
an inconsistency with Kawa Scheme's extended formal parameter lists.
The grammar appears to prohibit the following:

formal-arguments ::=
    req-opt-args (rest-key-args | . rest-arg)
req-opt-args ::= req-arg ... [#!optional opt-arg ...]

prohibits:

((lambda (#!optional (a 2)) (list a)))

But it works. However, ((lambda (#!optional (a 2) #!rest x) (list a
x))) fails quite spectacularly with an ArrayOutOfBoundsException.
Tracking this bug down is like tracking The Ghost Of Christmas Past
down. Lambda#rewriteFormals does this:

if (rest_args > 0)
      lexp.max_args = -1;

which I think might be causing the problem, but I'm getting lost in
the visitor recursion. This syntax is used in SBCL's
DESTRUCTURING-BIND for reasons not completely clear to me.

(The grammatically correct version (x #!optional (a 2) #!rest y)
doesn't fail.. But (&optional (a 2) &rest x) if *not* a grammatical
violation in CL). I'm not sure why the decision was made to require at
least one "req-arg".

The icing on the cake for today is that I'm getting an internal
compiler error when I try to compile my destructuring code:

<unknown>: Literals: Internal error:java.lang.Error: no method to
construct ClassType gnu.kawa.lispexpr.LispPackage

Has anyone seen that before? I'm not even using lisp packages in my
code, I assume it's some sort of bootstrapping error in the code I've
added, just thought I'd ask to see if anyone's been bitten by it
before.

Charles.


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