[parenscript-devel] Feature request: prefixed names

Red Daly reddaly at gmail.com
Thu Jun 21 03:33:01 UTC 2007

On 6/20/07, Vladimir Sedach <vsedach at gmail.com> wrote:
> Hi John,
> ...there's currently no notion of "whole Javascript program"
> in ParenScript, which besides wouldn't make sense if you're using
> ParenScript to write inline scripts. If everything is going to get
> name-mangled, then there would have to be some escape procedure for
> identifiers that you don't want to name mangle (functions in other
> Javascript libraries). Plus, you'd have to have a way to "export"
> identifiers when you want to make your own functions for other
> Javascript code to call. In short, I don't think there is a solution
> to this that would work well in more than one use case.

I prefer a Parenscript that departs from the exact semantics of Javascript
and a Parenscript compiler that performs more advanced analysis.  In this
case, introducing the concept of a "whole Parenscript program" would be
beneficial to Parenscript developers.  It will not only allow a more
sophisticated code generator (for minifying, prefixing, etc.) but could also
make it easier to extend the compiler, generate documentation for a
Parenscript program, and otherwise manipulate Parenscripts programmatically.

I suspect that there are manageable solutions to problems like inconsistent
"name manglings" across different compilations.  A package system that keeps
track of variable and function declarations can resolve identifier
references and rewrite them accordingly, leaving global or unresolved
identifiers alone.  A few months ago I implemented the first steps of a
package system for Parenscript that does some semantic analysis to
accomplish prefixing as described.[1]  I did not attempt to solve the
"inline scripts" issue, but that problem seems far from impossible.

Of course users have varying use cases.  I write lengthy programs in
standalone .paren files. Others may use Parenscript quite lightly to embed
scripts in HTML. We can probably find solutions that make everyone's life

I am generally of the opinion that Parenscript should be as close to Lisp as
possible. It is absurd that even in 2007 there is still so much fuss over
programming languages. It would be great if a separate Parenscript language
did not need to exist.


[1] remnants of that work are in the darcs repository for the Suave project
in the /suavescript/ directory: http://common-lisp.net/project/suave/

> Vladimir
> On 6/19/07, John Fremlin <john at fremlin.org> wrote:
> > Nowadays many things seem to want to include their JavaScript in your
> > webpages. Aside from the fact that this is annoying, dangerous and
> > wrong, we have to accept that it is quite prevalent: from Google
> > AdWords to ReCaptcha.
> >
> > If I might add a feature request, it would be to be able to make sure
> > that the identifiers generated by parenscript don't clash with
> > anything else.
> > _______________________________________________
> > parenscript-devel mailing list
> > parenscript-devel at common-lisp.net
> > http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
> >
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20070620/acb69357/attachment.html>

More information about the parenscript-devel mailing list