When D is not nice

JAnderson ask at me.com
Mon Jul 7 20:50:39 PDT 2008


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



More information about the Digitalmars-d mailing list