Es4-discuss Digest, Vol 14, Issue 49

Mike Samuel mikesamuel at gmail.com
Wed Apr 30 13:23:53 PDT 2008


> From: Jonathan Toland <jonahtoland at yahoo.com>
> To: es4-discuss at mozilla.org
> Date: Tue, 29 Apr 2008 18:34:18 -0700 (PDT)
> Subject: Re: Triple quoted strings
> i've been reading some past posts and wanted to add some supplemental input
> on this one and emphasize some key advantages to mirroring e4x templating
> syntax in triple quoted strings.  first currently beginning to work in as3 i
> highly regard the progress the wg has made.  es4 really has grown up into a
> very structured (yet still almost uniquely flexible, extensible, and
> dynamic) language in comparison to the tediousness of trying to scale up my
> js apps.
>
>  1. i have often missed string interpolation working in js although i have

http://google-caja.googlecode.com/svn/changes/mikesamuel/string-interpolation-29-Jan-2008/trunk/src/NOT-FOR-TRUNK/interp/index.html
outlines a way to bolt string interpolation onto existing interpreters
while avoiding the XSS problems that usually accompany string
interpolation.

It aliases eval, which is disallowed according to ES3, but that is
fixable.  I believe that this will break with the attenuated eval
proposals, but if some form of string interpolation is a goal, then
(1) it might provide a way to backport the feature onto legacy interpreters
(2) the XSS-safety might be useful to language designers


> never missed php's (and others?) multiline strings.  i don't mind chalking
> that up to inexperience and an unhealthy fondness for perl but i do feel
> string interpolation is arguably second only to regex (which i also love) in
> perl's historical success which both php and more effectlively ruby (with a
> syntax like e4x) mimic.
>
>  2. as the poster below alluded to as3 already provides string
> interpolationde facto via e4x.  anywhere a string is expected i can
> substitute a XML literal like <>Today is {new Date.toDateString()} and the
> time is {new Date.toTimeString()}.</> ver batim.  this does identify a few
> weaknesses however:



More information about the Es4-discuss mailing list