auto arr = [1, 2, 3] should be a static array, not a GC allocated array

ryuukk_ ryuukk.dev at gmail.com
Tue Jul 19 16:29:37 UTC 2022


On Tuesday, 19 July 2022 at 16:25:03 UTC, jfondren wrote:
> On Tuesday, 19 July 2022 at 15:27:57 UTC, ryuukk_ wrote:
>> - having to write the helper code
>> - having to tap into the std
>> - having then to import this helper module everywhere
>> - having to spend time doing all of the above and carry that 
>> file in all my projects
> ...
>> For something as basic as wanting an inferred fixed static 
>> array length
>
> "This is basic" isn't that persuasive, and realistically the 
> solution isn't all of that but just "import the improved 
> template and then use it".
>
> Try these:
>
> - D should be at *least* as convenient as C. Here, it is 
> clearly worse.
>
> - D should retain an advantage of fast compilation. 
> Microbenchmarks easily show that compilation is slower with 
> this template (and results in larger objects--larger with each 
> different length and type of array).
>
> - Do you really want someone to think about a choice like this? 
> Between tediously counting the members of static arrays, or 
> having faster and slimmer builds? Do you want to see a D style 
> guide with such a suggestion in it?

Of course, that is why i referred to "template soup" when talking 
about std.sumtype instead of built in tagged union, in the other 
post

But i am afraid of pointing out too many things will make me 
sound too negative and just getting ignored as a result, it is 
tiring to constantly have to remind everything, so i tend to just 
rush unfortunately


More information about the Digitalmars-d mailing list