+1 from me but that doesn't mean too much.<div><br></div><div>No need to explicitly set them as `null`, because JS already has (the more semantic in this case) `undefined`.<br clear="all"><br>_Nick_<br><br>
<br><br><div class="gmail_quote">On Wed, Aug 4, 2010 at 12:30 PM, Daniel Gackle <span dir="ltr"><<a href="mailto:danielgackle@gmail.com">danielgackle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
The code that's generated for a keyword argument goes like this:<div><div><br></div><div><div>(ps (defun foo (&key a) (bar a))) => </div><div><br></div><div>(abbreviated for clarity):</div><div><br></div><div>
"function foo() {</div>
<div> var a;</div><div> // ... pick out and assign keyword args ...</div><div> if (a === undefined) {</div><div> a = null;</div><div> };</div><div> return bar(a);</div><div>};"</div></div></div>
<div>
<br></div><div>It seems to me that this could be made tighter as follows:</div><div><br></div><div><div>"function foo() {</div><div> var a = null;</div><div> // ... pick out and assign keyword args ...</div><div>
return bar(a);</div><div>};"</div></div><div><br></div><div>The only difference I can think of is when someone explicitly passes undefined</div><div>as a value for the argument, but that's an oxymoronic thing to do.</div>
<div><br></div><div>Can anyone think of a reason not to make this change? I like PS's keyword</div><div>arguments a lot, but the generated JS is bloated enough to make me wince.</div>
<br>_______________________________________________<br>
parenscript-devel mailing list<br>
<a href="mailto:parenscript-devel@common-lisp.net">parenscript-devel@common-lisp.net</a><br>
<a href="http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel" target="_blank">http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel</a><br>
<br></blockquote></div><br></div>