Triple-strings
And another topic which I'd like to separate from the doc-comments topic is the "triple-strings". The rationale is not to escape the double/single quotes when describing something bigger than one line (usually these are comments, but other simple strings with many of double quotes are also the case).
var description = " This is "ECMAScipt", "The language of the 'Web' " ".
vs.
var description = ' This is "ECMAScript", "The language of the 'Web' " '
vs.
var description = """ This is "ECMAScript", "The language of the 'Web' " """
It also may continue to new lines without escaping and concatenation:
" This is "ECMAScipt"," + ""The language of the 'Web' " ".
vs.
""" This is "ECMAScript", "The language of the 'Web' """"
?
Dmitry.
On Aug 24, 2011, at 2:44 AM, Dmitry A. Soshnikov wrote:
Hi again,
And another topic which I'd like to separate from the doc-comments topic is the "triple-strings". The rationale is not to escape the double/single quotes when describing something bigger than one line (usually these are comments, but other simple strings with many of double quotes are also the case).
We had a triple-quoted string proposal for ES4. That was long ago.
The answer now is quasi-literals:
No need to stutter " three times -- just use `. Did you miss this one? I need to talk it up more.
On 24.08.2011 20:19, Brendan Eich wrote:
Ah, didn't know, thanks.
Yes, I'm aware about
quasis
, but seems inattentively considered all the cases.Yes, definitely. Thanks for mention.
OK, then the topic with """ is obsolete.
Dmitry.