PROPOSAL: Multiline strings
rssh at gradsoft.com.ua
rssh at gradsoft.com.ua
Tue Mar 3 02:11:01 PST 2009
> This proposal is missing many important details.
Thanks, I prepared reviewed proposal
understand, thanks for clafifying.
> What are the grammar changes?
Originally idea was:
""" MultilineStringCharacters/opt """
MultilineStringCharacters MultilineStringCharacter but not "
(MultilineStringCharacters but not "") ""
InputCharacter but not \
But now if we want keep type of LineTermination and unescaped sequence,
this will be .. as in next version which I will send by next letter.
> Is are three consecutive quote characters escaped in a multi-line string?
\""" will be as (\")""", where \" is EscapeSequence, therefore be escaped.
> As has been mentioned in earlier responses, how is whitespace handed?
First idea was does not handle ones at all, now I think that best is adopt
proposition by Reinier Zwitserloot (which is the same as in proposal in
project koin [http://docs.google.com/View?docid=d36kv8n_32g9zj7pdd]
by Jacek Furmankiewicz
>> Multiline strings created and used in .class files exactly as ordinary
> What is the desugaring?
Ok, detailed description is added.
Text withing """ brackets processed in next way:
1. splitted to sequence of lines by line termination symbols.
2. escape sequences in each line are processed exactly as in ordinary Java
3. elimination of leading whitespaces are processed in next way:
- at first determinated sequence of whitespace symbols (exclude
LineTermination, i.e. ST, HP, FF) at first nonempty line in sequence.
let's call it 'leading whitespace sequence'
- all next lines must start with same leading whitespace sequence,
otherwise compile-time error is thrown.
- whitespace processing erase such leading sequence from resulting lines
4. set of lines after erasing of leading whitespace sequence is
concatenated, with line-termination sequences between two neighbour lines.
Inserted linetermination sequence is depend from LineTerminationSuffix,
- value of systen property 'line.separator' is LineTerminationSuffix is empty
- LF (i. e. '\n') when LineTerminationSuffix is 'U' or 'u'
- CR LF (i. e. '\r''\n') when LineTerminationSuffix is 'W' or 'w'
>> Nothing special. add multiline strings to test-cases.
>> LIBRARY SUPPORT:
>> (May be exists sence add simple template processing to standard
>> library, but
>> I think this is goal of next janguage iteration. Now exists many good
>> frameworks, such as velocity: better wait and standartize support of
>> REFLECTIVE APIS: None
>> OTHER CHANGES: None
>> MIGRATION: None
More information about the coin-dev