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 Sat 24th Apr 2004 03:20 UTC

> Your arguement about the whole sting thing is off because
> you are thinking in C.

I don't know who you are refering to, but I can assure you that at least _I_ most certainly am not thinking in C by default.

> string a = null; doesn't really work with strings in this
> language because strings aren't pointers.

You are probably right in that 'char[] a=null;' won't work in D. From the specs: "Dynamic arrays are initialized to having 0 elements."

> I think it will treat it as a = null the same way as n = "".

I assume you mean 'a = ""', and yes, I think you are right, and this is where I think the design is stupid. You see, there are many times when you want to express that something should be unspecified rather than empty, or empty rather than unspecified. If the language can't handle this then you have to make ugly workarounds, which isn't nice at all. This is what I've been trying to explain the whole time.