[Issue 3889] Forbid null as representation of empty dynamic array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 17 04:35:05 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3889



--- Comment #4 from bearophile_hugs at eml.cc 2010-11-17 04:33:47 PST ---
(In reply to comment #3)

> I think, null is easier to parse.

Here I don't care if for 'null' is easier to parse by the compiler. Here I care
more for the programmer and the semantics in his/her head. An array is not a
pointer, so it's not null, it's a two-word-long struct. It's more like a
<null,0> pair.


> null is a handy visual anchor, but [] doesn't even look like a value, one
> should spend some effort to recognize it as a value.

I don't understand what you mean. In that context [ ] are delimiters for a
particular kind of built-in collection.
So this is an array with two items inside: [1, 2]
This is an array with one items inside: [1]
And this is an (untyped) array with zero items inside: []
Understanding this sequence requires no mental efforts.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list