Suggestions to triple quoted strings proposal
brendan at mozilla.org
Wed Dec 13 13:26:08 PST 2006
On Dec 13, 2006, at 1:15 PM, Brendan Eich wrote:
> On Dec 13, 2006, at 10:59 AM, Stepan Koltsov wrote:
>> Brendan, or anybody else who wants multiline strings should to behave
>> like in Python,
>> Could you please write complex-enough example of code with TQS? In
>> that example string constant should be declared inside method inside
>> class. There is no good example at
>> http://developer.mozilla.org/es4/proposals/triple_quotes.html .
> You're right there's no good example, but the Python docs have
> examples, and real code has even more compelling examples. Two
> arguments here:
Of course, I revised the list to make three:
> 1. "Be like Python, reuse brainprint from JS hackers who know
> Python and Python hackers learning JS". This is non-trivial. It's
> not just "marketing". It makes the world better to avoid defining
> """ differently in ES4/JS2 from Python.
> 2. "Be like Python, stand on its shoulders and reuse the
> experience that informed its design decisions and defaults". This
> is certainly a gamble, since JS is not Python, and Python ain't
> perfect (JS is far from perfect). But with some care (e.g.,
> eliminating GeneratorExit in the JS Pythonic generators available
> now in Firefox 2, and going into ES4), it can pay off. There's
> probably value here, unless Python has failed to heed negative
> feedback on non-stripping """.
> 3. Quote means verbatim contents modulo escapes and special case
> for embedded newlines, i.e. literal. Trimming or stripping does
> not fit under the notion of "literal". Bob and I have made this
> point, it's about intuition more than optimizing for the common case.
But this is not meant to puff up the case for Pythonic """ -- point 3
is pretty strong by itself. Anyway, as you say the crucial question
is: what's the most common use-case?
More information about the Es4-discuss