Discussion Thread: DIP 1039--Static Arrays with Inferred Length--Community Review Round 1
Dukc
ajieskola at gmail.com
Thu Jan 7 15:27:09 UTC 2021
On Thursday, 7 January 2021 at 13:03:54 UTC, Luhrel wrote:
> I don't get it.
> 1. `y` should be a int[].
True - see my correction at the feedback theard.
> 2. if staticArrFunc returns a size_t, then the problem can be
> simplified as:
> ```
> staticArrFunc(cast(int[$])[1,2,3]); // no need to cast :
> staticArrFunc([1,2,3]); // already works like that (if
> staticArrFunc takes a int[3])
> ```
If your DIP is implemented, what you say is true. But the point
is that right now it means a different thing - a cast to static
array of the length of `something` (in the full example), not to
length of `[1,2,3]`. The point is that your DIP will silently
change the behaviour of code like this.
I do agree that this is such a rare enough occurence that we
might be best off just accepting it. But it needs to be mentioned
in the DIP.
More information about the Digitalmars-d-announce
mailing list