Discussion Thread: DIP 1039--Static Arrays with Inferred Length--Community Review Round 1

Q. Schroll qs.il.paperinik at gmail.com
Wed Jan 13 18:01:07 UTC 2021


On Wednesday, 13 January 2021 at 15:40:35 UTC, Nick Treleaven 
wrote:
> On Tuesday, 12 January 2021 at 17:27:50 UTC, Q. Schroll wrote:
>> On Monday, 11 January 2021 at 21:17:20 UTC, jmh530 wrote:
>>> Gotcha. I think I would use that more than the current DIP 
>>> (though I prefer [1]s to [1]$).
>>
>> You can do it today if you don't mind putting the marker in 
>> front: https://run.dlang.io/is/E6ne4k (Its operator abuse. 
>> What would you expect?)
>
> Cool. I'd call it F for fixed size array, `F[e1,e2]`.

[rant]
Calling T[n] an array is correct and useful. In my opinion, 
calling T[] an array is wrong, not even imprecise, plain wrong. 
It's a slice: a typed part of memory that may overlap with arrays 
and other slices, potentially even typed differently. "Array" 
gives one, at least it gives me, a wrong impression how the 
object behaves. Have you seen overlapping "arrays" in any other 
language? I have not.

Calling T[] an array (sometimes) is the biggest didactic mistake 
the D community makes. That way, it is unnecessarily hard to 
learn the concept for anyone who already has an idea what an 
array is.
[/rant]


More information about the Digitalmars-d-announce mailing list