Line Terminators (and others) normalization in template strings

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Sep 26 11:50:16 PDT 2013


Two thoughts below:

On Sep 26, 2013, at 11:31 AM, Brendan Eich wrote:

>> Anne van Kesteren <mailto:annevk at annevk.nl>
>> September 26, 2013 5:41 AM
>> 
>> What Tab meant is that within the platform only CR and CRLF are
>> normalized to LF and no other code points. This is true for HTML as
>> well.
> 
> This thread is to sort out the LINE and PARA seps. No one likes 'em. JSON missed them. They seem to me only useful for subtle line-numbering/source-hiding attacks. But ECMA-262 would be inconsistent to turn a blind eye toward them.

Would any code in the world break if ES stopped treating LINE and PARA as lexical line terminators?  I know, nobody knows...

> 
> Which consistency is greater, HTML or JS standard consistency?

We presumably normalizing so that the meaning of a ES program is not sensitive to the language termination conventions of the platform used to create the source code of the program or any where along the line from creating the source code to the point it is present to the ES engine.  If no known code editors or OS platforms actually use LINE or PARA as normal line terminators then it seems reasonable that the author explicitly inserted those character (and they probably are showing up as line breaks in their editor) into a template string because she really wanted a LINE or PARA character to show up.

Allen


More information about the es-discuss mailing list