More D newb questions.
Walter Bright
newshound1 at digitalmars.com
Mon May 5 14:16:02 PDT 2008
Me Here wrote:
> What elese could 'a' ~ 'b' mean other than char[] tmp = "ab"?
Let's generalize the issue to be what does:
T ~ T
mean for any type T? Your argument is that the result should be T[]:
T ~ T => T[]
Ok. So imagine now that T is S[]:
S[] ~ S[] => S[][]
and we've done away with array concatenation. We could make a special
case just for char values (and presumably all basic types), but then
we'll find ourselves unable to write generic code.
T ~ T[] => T[]
T[] ~ T => T[]
has no such ambiguity, and so is supported.
More information about the Digitalmars-d
mailing list