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

Petar Petar
Tue Jan 12 19:27:31 UTC 2021


On Tuesday, 12 January 2021 at 18:19:14 UTC, jmh530 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:
>>> On Monday, 11 January 2021 at 14:42:57 UTC, Nick Treleaven 
>>> wrote:
>>>> [snip]
>>>>
>>>> Just a suffix like `[1,2]$` or `[1]s`. Then just use `auto 
>>>> var =` with it as normal.
>>>
>>> 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?)
>
> Interesting approach! However, it doesn't really resolve my 
> underlying issue, which was that I would still need to import 
> that s struct.

To play the devil's advocate, it shouldn't be hard to change the 
compiler config file to auto-import any module of your choice (it 
config file would simply append it to the compiler command line).

That said, for me the unnecessary template instances generated 
for each different type and array length is a bigger reason for 
me preferring this DIP proposal, over the library approach.


More information about the Digitalmars-d-announce mailing list