When D is not nice

Tomas Lindquist Olsen tomas at famolsen.dk
Tue Jul 8 05:12:18 PDT 2008


JAnderson wrote:
> Frank Benoit wrote:
>> String concatenation in Java:
>>
>> "abc " + a + " bla";
>>
>> where a is an interface ref.
>>
>> Ported to D, this look like this:
>>
>> "abc " ~ (cast(Object)a).toString ~ " bla";
>>
>> This are 3 steps more:
>> 1.) explicit cast to Object (interface/class compatibility!)
>> 2.) explicit call to toString
>> 3.) put additional parentheses
>>
>> I would be happy if we could remove all three of this annoying points.
> 
> I agree, string handling could be better its such a common operation. 
> Its one of worst things to work with in C++.  Implicit string 
> conversions would make things much easier and more readable.
> 
> -Joel

I think STL solves this quite nicely with std::ostringstream ... Though I might be 
misunderstanding you...

Tomas



More information about the Digitalmars-d mailing list