<br><br><div class="gmail_quote">On Sat, Apr 25, 2009 at 12:02 PM, Daniel Gackle <span dir="ltr"><<a href="mailto:danielgackle@gmail.com">danielgackle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If I understand correctly, then yes, we object.<br><br>We have a lot of code that uses keywords as standalone values (e.g. tokens in an AST), not keyword args to functions.</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It's important to have a way of treating keywords that allows for both of these usages. In other words, a keyword's presence in a lambda list might be (A) the name of a keyword arg or (B) a regular old function arg (a runtime value).</blockquote>
<div><br>What do you mean by "a runtime value?" In the current Parenscript keywords are compiled to the variable with the same name as the symbol. If you wanted a variable reference, you could replace a form like (foo :bar whiz) to (foo bar whiz).<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> The trouble with the old implementation of keyword args in PS is that it forced interpretation (A) on all keywords in lambda lists, breaking a good many of our functions.</blockquote>
<div><br>I am still confused about what functions this assumption is breaking, since quoted symbols are not translated into a JS equivalent. Can you provide a concrete example?<br></div><div> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The code that's in PS right now supports both usages. It relies on the JS "arguments" keyword to allow functions with keyword args to pick out the dynamic portion of their lambda list without requiring them to be bundled into a magic JSON object under-the-hood. That magic JSON object caused us some trouble as well. </blockquote>
<div><br>The magic JSON object should be transparent to you when you define keyword arguments. That is, unless you are talking about a &rest or &keyword-object, both of which operate differently for parenscript functions than lisp functions.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">We have a layer of our system written in a subset of CL that we are able to compile into PS using macros. (This has critical business value as it allows us to do some things which our competitors cannot.)</blockquote>
<div><br>This is a slick feature of Parenscript. Hopefully at some point we will see a full lisp -> javascript converter so that more code can be shared between client/server. Parenscript already does a lot more than any other solution out there for client/server code compatability (besides writing the server side in Javascript).<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> The magic JSON object created an impedance mismatch with Lisp that made it impossible for us to write code in this subset that used keyword args (we'd have to write a separate JS version to suck function args out of the JSON object, which has no counterpart on the Lisp side). In general, although I'm skeptical of attempts to make PS overly Lispy in ways that don't have good equivalents in JS semantics, I also think that where there are opportunities to align Lisp and PS semantics naturally, we should do so.</blockquote>
<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Daniel </blockquote><br>Agreed, for Parenscript. I would prefer true Lisp that compiles to Javascript, but I don't think that's what Parenscript should be.<br>
</div><div> </div><div><br>-Red <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><br><br><div class="gmail_quote"><div><div>
</div><div class="h5">On Sat, Apr 25, 2009 at 9:38 AM, Red Daly <span dir="ltr"><<a href="mailto:reddaly@gmail.com" target="_blank">reddaly@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">
Hello ParenScripters,<br><br>I have modified the behavior of keywords found in Parenscript source to be parsed into (PS-QUOTE keyword) instead of (JS-VARIABLE keyword). This seems to make more sense because in Lisp, evaluating a keyword yields the keyword itself rather than the value bound to it. As a result, the ability to paass keyword arguments to functions is now restored.<br>
<br>CL-USER> (ps:ps (foo "bar" :quix "quo" :etc "etc..."))<br>"foo('bar', { quix : 'quo', etc : 'etc...' });"<br><br>Whereas this used to yield foo('bar', quix, 'quo', etc, 'etc...')<br>
<br>In general, symbols occupy a strange place in Parenscript. Javascript has no analogue of Lisp symbols, so there is no sensible translation of symbols that works for everyone. Nonetheless, quoted symbols are used in many Parenscript macros to fake having real symbols in javascript. We could build in the ability to translate symbols to some javascript form, e.g.<br>
<br>(ps:ps (make-instance 'animal)) => makeInstance( symbolTable["ANIMAL"] )<br><br>The latter part of this post is just food for thought. I will go ahead and commit the patch for the former part of this post unless someone objects.<br>
<font color="#888888">
<br>Red<br>
</font><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>
<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>