Send empty assoc array to function

Mike Parker aldacron at gmail.com
Fri Jul 10 03:59:37 UTC 2020


On Thursday, 9 July 2020 at 21:13:49 UTC, JN wrote:

>
> Interesting. Often in D discussion, an argument pops up that 
> the language should be protecting against hidden breakages from 
> API changes. This would be an example of that happening.
>
> void foo(int[int] bar), someone calls it with a null, suddenly 
> the signature changes to void foo(int* bar) and you will be 
> sending a null pointer and possibly breaking the app.

Meh. You could say the same about foo(int[]), or foo(SomeClass). 
AAs are reference types. Reference type instances can be null.


More information about the Digitalmars-d-learn mailing list