Send empty assoc array to function
maxsamukha at gmail.com
Fri Jul 10 08:15:24 UTC 2020
On Thursday, 9 July 2020 at 21:04:57 UTC, Steven Schveighoffer
>> Why isn't  accepted as an empty AA literal?
> Because it's an empty dynamic array literal.
> If D were to accept an empty AA literal, I'd expect it to be
Just as typeof(null) is a subtype of all nullable types, you
could make typeof() a subtype of both AAs and dynamic arrays.
[:] could still be made a specifically AA literal.
BTW, writeln((int[int]).init) prints "" (to!string((V[K]).init)
== ""), but pragma(msg, (int[int]).init) - the more general
'null' ((V[K]).init.stringof == "null"), which is a unfortunate
More information about the Digitalmars-d-learn