[parenscript-devel] Tighter keyword arguments?
Vladimir Sedach
vsedach at gmail.com
Wed Aug 18 05:33:59 UTC 2010
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 <danielgackle at gmail.com>:
> 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
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
>
More information about the parenscript-devel
mailing list