On Thursday, 4 July 2013 at 23:52:35 UTC, bearophile wrote:
Andrei Alexandrescu:

Where does the whole "stronger typing" comes in? This is poppycock. We need real arguments here.

Maybe it's a matter of definitions, for me having "null" as literal for empty array, null pointer, empty associative array, and more is more weakly typed compared to having a literal like [] usable only for empty dynamic arrays (and strings), a literal as [:] usable only for empty associative arrays, and null for pointers, class references (and little else like a Nullable).

Bye,
bearophile

While I agree with the need to have a literal for non-initialized arrays and another one for initialized but empty arrays, that is null and [] respectively, I can't see the necessity for [:]. The literal should be used to mark the difference between null and empty, not the difference between plain or associative, shouldn't it?
For me, having to type
  int[string] foo = [:];
instead of
  int[string] foo = []; // same semantic
would just be a source of confusion.

Reply via email to