Ok, I just realized that I completely misread your original post. I thought you were proposing the removal of defaulting to null rather than leaving the value undefined.
Good point. I kept the null assignment for consistency with how PS does &optionalarguments. But this begs the question: why do we care about &optionaland &key arguments being set to null, as opposed to just leaving them undefined?I'm trying to remember the reason... anybody?Our experience has been that PS code works best if one treats null and undefinedas interchangeable. But that may be an artifact of running some of the same codein CL as well, where there is no such distinction.On Thu, Aug 5, 2010 at 1:51 PM, Nick Fitzgerald <fitzgen@gmail.com> wrote:
+1 from me but that doesn't mean too much.No need to explicitly set them as `null`, because JS already has (the more semantic in this case) `undefined`.
_Nick_
On Wed, Aug 4, 2010 at 12:30 PM, Daniel Gackle <danielgackle@gmail.com> wrote:
_______________________________________________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 undefinedas 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 keywordarguments a lot, but the generated JS is bloated enough to make me wince.
parenscript-devel mailing list
parenscript-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
_______________________________________________
parenscript-devel mailing list
parenscript-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
_______________________________________________
parenscript-devel mailing list
parenscript-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel