< Unlike the JS form, a Parenscript macro definition does involve any Javascript translation. For a concise alternative to "defscriptmacro" I think "defpsmacro" is more accurate. defjsmacro seems incorrect since you are defining something that operates purely at the Parenscript level. >
That's a good point. I agree.
< I might actually prefer a with-style macro for embedding Parenscript code similar to "with-output-to-string" >
We wrote something like this and use it in our project. I'd be interested in the alternatives here.
Still, I like writing (js (blah)) for short expressions, especially in the REPL.
Dan
On 7/30/07, Red Daly reddaly@stanford.edu wrote:
Daniel Gackle wrote:
I agree with renaming Parenscript's package from :js to :parenscript or :ps. Indeed, just :parenscript would be fine. A library and its package should usually have the same name. However, some of the function and macro names that Parenscript now complains are deprecated, I actually prefer to their replacements.
For example, the js macro is accurately named. I prefer this:
(js (setf x 1))
to this:
(ps (setf x 1))
...because "js" reminds me that I'm generating Javascript (not Parenscript). To me it's closer to the meaning. What I especially don't like, though, is this:
(script (setf x 1))
... because there are at least two other scripting languages embedded in my Lisp code, and the term "script" could apply to any of them. I need to know at all times which kind of script I'm working with. In this case it's Javascript.
SCRIPT: I used SCRIPT because if you consider the full symbol name, PS:SCRIPT it should be obvious what type of script you are embedding. In the context of the Parenscript package, "script" means Parenscript.
It seems difficult to communicate the meaning of the macro with a single word. Maybe JS, JS*, PS, and PS* are all bad.
I might actually prefer a with-style macro for embedding Parenscript code similar to "with-output-to-string" or the "with-html-output" form in CL-WHO:
(with-js-output (option*) parenscript-form*) => javascript result
Similarly, I much prefer "defjsmacro" to "defscriptmacro". Much clearer and more expressive.
Unlike the JS form, a Parenscript macro definition does involve any Javascript translation. For a concise alternative to "defscriptmacro" I think "defpsmacro" is more accurate. defjsmacro seems incorrect since you are defining something that operates purely at the Parenscript level.
There's sort of a philosophical point here. I don't see Parenscript as a separate language. I see it as an interface to Javascript. I don't want an extra mental layer getting in the way, and I certainly don't want to forget that I'm writing Javascript. (I love using macros to build up abstractions in Parenscript - in fact that's a big reason I use PS - but to me that's a separate issue.) Bottom line, I have a moderate preference for "js" names instead of "ps" ones and a strong objection to the generic term "script". What do others think?
Daniel
Red
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