Inferring static array size

NotYouAgain NotYouAgain at gmail.com
Sun Apr 28 09:31:01 UTC 2024


The idea is simple, really, really simple.

Instead of this:

  int[5] a = [1, 2, 3, 4, 5];

allow this:

  int[$_] a = [1, 2, 3, 4, 5];

Both are static arrays.

Having to change the length everytime i change the initialisation 
list is a pain in the $____

The compiler infers the size in the second example, based on the 
number of elements in the initialisation list. Just like C can do.



More information about the dip.ideas mailing list