It looks like this change broke the &KEY-OBJECT parameter (at least
for my branch).  It also seems to incorrectly identify non-keyword
arguments that happen to match keyword args

(defun xxx (&key foo)
  foo)

(xxx :bar :foo :foo 7) ;; => 'foo', but should be 7


I don't mind the loop approach, though it would be nice to lessen the
generated code.

Red

On Tue, Aug 17, 2010 at 10:33 PM, Vladimir Sedach <[email protected]> wrote:
> I pushed a patch that simplifies keyword and optional parameter processing.
>
> I don't know what browsers you're targeting, but if you want even less
> noise, set *js-target-version* to 1.6 and it will use Array.indexOf to
> get at the keywords.
>
> Vladimir
>
> 2010/8/4 Daniel Gackle <[email protected]>:
>> The code that's generated for a keyword argument goes like this:
>> (ps (defun foo (&key a) (bar a)))  =>
>> (abbreviated for clarity):
>> "function foo() {
>>     var a;
>>    // ... pick out and assign keyword args ...
>>     if (a === undefined) {
>>         a = null;
>>     };
>>     return bar(a);
>> };"
>> It seems to me that this could be made tighter as follows:
>> "function foo() {
>>     var a = null;
>>    // ... pick out and assign keyword args ...
>>     return bar(a);
>> };"
>> The only difference I can think of is when someone explicitly passes
>> undefined
>> as a value for the argument, but that's an oxymoronic thing to do.
>> Can anyone think of a reason not to make this change? I like PS's keyword
>> arguments a lot, but the generated JS is bloated enough to make me wince.
>> _______________________________________________
>> parenscript-devel mailing list
>> [email protected]
>> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>>
>>
>
> _______________________________________________
> parenscript-devel mailing list
> [email protected]
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>

_______________________________________________
parenscript-devel mailing list
[email protected]
http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel

Reply via email to