More D newb questions.
Bruce Adams
tortoise_74 at yeah.who.co.uk
Fri May 9 15:45:18 PDT 2008
On Fri, 09 May 2008 12:31:55 +0100, Me Here <p9e883002 at sneakemail.com>
wrote:
>
> Pursuading programmers that there is little conceptual difference
> between a
> single char and a string of one char, and that they should be usable
> interchangably? Now that could be a real challenge :)
>
> b.
There are as other have already pointed out a number of very signficant
conceptual differences.
If you want to ignore them you should prefer a less strongly typed
language.
That said is there any reason we couldn't have an implicit (possibly user
defined) cast to array when
no other implicit casts apply?
i.e.
T[] opImplicitCast(T a) {
return T[](a);
}
This still wouldn't permit 'a' ~ 'b' so long as there is a valid meaning
for int~int
but it would be useful in other places. Thinking about it, it could
already be built-in
I can't honestly remember.
void myFunction(foo[] A);
myFunction('a') --> myFunction(['a']);
More information about the Digitalmars-d
mailing list