ES4 draft: Triply quoted string literals

liorean liorean at
Mon Mar 3 18:26:18 PST 2008

On 04/03/2008, Waldemar Horwat <waldemar at> wrote:
> I'm not sure what the intent is, but as this is written:
>  """abc""""def"""
>  will evaluate to the same string as 'abc""""def'.

That's not how I read the spec. As I read it, it will evaluate to the
same string as 'abc"', followed by a nonsensical def""" which should
trigger a syntax error.

>  Furthermore,
>  """\"""
>  turns into:
>  \
>  to which we're then supposed to apply escape processing, but that is not possible because there is no character following the backslash.  What happens?

No it doesn't. That is three quotes followed by an escaped quote
followed by two quotes (which do not end the triply quoted string), as
I read the spec.

  >  What does the following evaluate to?
>  """\n\\\"\t"""
>  Is it the same as "\n\\\"\t"?

Looks to be so, yeah.

>  If so, then triple quoting seems like an extraneous feature, as we still need to go through and double every backslash located inside the string.

Seems so to me.
David "liorean" Andersson

More information about the Es4-discuss mailing list