Would it make sense to use declaim/declare to give the Closure compiler hints?

(defun foo (x)
  (declare (param (*number *String) x))
  (if (instanceof x *Number)
    (+ x "")
    x))

=>

"/*
 * @ param {Number|String} x
 */
function (x) {
    return x instanceof Number ? x + "" : x;
}"

This seems like maybe it is too specific to be a part of ParenScript on the whole though...

_Nick_



On Sun, Aug 22, 2010 at 9:55 AM, Bastian Müller <bastian@turbolent.com> wrote:
On 08/22/2010 06:12 PM, Vladimir Sedach wrote:

Hi Vladmimir,

> Are you making a library? If so, are you looking to document
> particular functions, or insert inline comments in arbitrary places?
> If it's the functions, then it might make sense for me to add
> optional output of function and variable docstrings to JS comments;
> that would spare the need for a new special form and syntax for
> comments.
>
> As for arbitrary JS code, if there is a case where there is some JS
> code that you need that cannot be generated by Parenscript, it
> should be considered a bug in Parenscript.

Indeed, I'd like to create docstrings for functions and variables, so
that Google's Closure compiler can be used to optimize and check the
generated JavaScript Code. The annotations are documented here:

http://code.google.com/closure/compiler/docs/js-for-compiler.html

The comment special-form was the only thing I was able to add to
parenscript. Docstrings would help a lot. On top of them, a separate
library could provide convenience macros to generate the annotation
comments compatible with Closure.

Cheers,
 Bastian

_______________________________________________
parenscript-devel mailing list
parenscript-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel