[parenscript-devel] Tighter keyword arguments?

Daniel Gackle danielgackle at gmail.com
Wed Aug 4 19:30:06 UTC 2010


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20100804/3418b788/attachment.html>


More information about the parenscript-devel mailing list