Good point. I kept the null assignment for consistency with how PS does &optional<div>arguments. But this begs the question: why do we care about &optional</div><div>and &key arguments being set to null, as opposed to just leaving them undefined?</div>

<div>I'm trying to remember the reason... anybody?</div><div><br></div><div>Our experience has been that PS code works best if one treats null and undefined </div><div>as interchangeable. But that may be an artifact of running some of the same code</div>

<div>in CL as well, where there is no such distinction.</div><div><br></div><div><br><div class="gmail_quote">On Thu, Aug 5, 2010 at 1:51 PM, Nick Fitzgerald <span dir="ltr"><<a href="mailto:fitzgen@gmail.com">fitzgen@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">+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"><div><div></div><div class="h5">On Wed, Aug 4, 2010 at 12:30 PM, Daniel Gackle <span dir="ltr"><<a href="mailto:danielgackle@gmail.com" target="_blank">danielgackle@gmail.com</a>></span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
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></div></div>_______________________________________________<br>
parenscript-devel mailing list<br>
<a href="mailto:parenscript-devel@common-lisp.net" target="_blank">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>
<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>