Linked by Owen Anderson on Mon 19th Apr 2004 05:43 UTC
General Development For years the development scene has been dominated by the C family of languages, primarily C itself and its immediate successor C++. Recent years have given rise to other C-descendents, however, such as Sun's Java and Microsoft's C#.
Permalink for comment
To read all comments associated with this story, please click here.
RE: They are strings not null pointers
by Marcus Sundman on Wed 28th Apr 2004 21:30 UTC

> As I see, it matter of taste, and convention. D treats
> stings as primitive type, and not as an object type, as
> most of the strictly typed OO languages which I know

I'm pretty much against having primitive types in an OO language (now understand that I did not say that the implementations shouldn't use primitive types), but that is, as you say, a matter of taste.
If D indeed does treat a dynamic array as a primitive type then ""==null should be semantically incorrect since NULL is the "nothing" pointer target, and can therefore only be assigned to pointers. This is why g++ spews warnings such as "converting to non-pointer type `int' from NULL" when trying to do silly things like int n=NULL;. (A compiler for a decent language should really make this an error instead of a warning.) So any way you put it ""==null just can't be considered right in general. Whether it should generate a compiler error or just be false is a matter of taste.