Proposal: Embedded Expressions for String Statements

phil swenson phil.swenson at gmail.com
Thu Mar 19 08:33:37 PDT 2009


funny, i just joined the list specifically to ask about this subject.

why not just copy the groovy implementation of this?   $var or ${expresion} ?
in groovy it would be:
"[$field1, $field2, $field3]"

or with the explicit expression syntax:
"[${field1}, ${field2}, ${field3}]"


I hate escape characters :)


On Thu, Mar 19, 2009 at 2:03 AM, Schulz, Stefan <schulz at e-spirit.de> wrote:
> The concat-variant to me is even worse readable than the original +-notation, having three consecutive commas in between.
> The proposal already mentions concatenation of any kind as alternative, although not mentioning concat(). Maybe worth expanding.
>
> Stefan
>
>> -----Original Message-----
>> From: rssh at gradsoft.com.ua [mailto:rssh at gradsoft.com.ua]
>> Sent: Wednesday, March 18, 2009 8:58 PM
>> To: Howard Lovatt
>> Cc: coin-dev at openjdk.java.net; Schulz, Stefan
>> Subject: Re: Proposal: Embedded Expressions for String Statements
>>
>> > I like Stefan's proposed syntax and as a way of a motivating example
>> > consider writing a toString method that gives the field
>> values within
>> > square brackets, now you would write:
>> >
>> >     "[" + field1 + ", " + field2 + ", " + field3 + "]"
>> >
>> > With the proposal you would say:
>> >
>> >     "[\{field1}, \{field2}, \{field3}]"
>> >
>> > Which I find clearer.
>> >
>>
>> Just note: now we can use much cleaner
>>  concat( field1, ',' , field2, ',' field3 )
>>
>>
>>
>> > Many thanks to Stefan for writing this up formally.
>> >
>> >
>>
>>
>>
>>
>
>



More information about the coin-dev mailing list