When D is not nice

Bruno Medeiros brunodomedeiros+spam at com.gmail
Sun Jul 27 07:47:46 PDT 2008


Jarrett Billingsley wrote:
> "Ary Borenszweig" <ary at esperanto.org.ar> wrote in message 
> news:g4rsi1$2cnt$1 at digitalmars.com...
>> How is it a pointless hole in the type system? I thought having "~" be the 
>> concatenation operator instead of "+" was just to prevent that hole.
> 
> It's a bunch of special cases and a weakening of the type system in one area 
> for no benefit that I can see short of a few saved keystrokes.  The 
> semantics of the concatenation operator would have to be changed for string 
> types (char[], wchar[], dchar[] -- and any permutation of const and 
> invariant of those in D2), but not for any other array types, which is ugly. 

But a string (as in the string data type, conceptually) is already a 
special case. It just happens that in D a string is implemented as a 
char[] (or wchar[], dchar[]). I wouldn't mind if there were 
concatenation operators for these kinds of arrays only. Although it does 
it does make me wonder if it would be better for a string to be a 
special type, such as a struct wrapping a char[], etc..



-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list