static array with inferred size

jmh530 john.michael.hall at gmail.com
Thu Sep 21 19:00:57 UTC 2017


On Wednesday, 20 September 2017 at 16:34:36 UTC, Andrei 
Alexandrescu wrote:
> On 09/20/2017 08:36 AM, jmh530 wrote:
>> On Wednesday, 20 September 2017 at 12:10:47 UTC, Andrei 
>> Alexandrescu wrote:
>>>
>>> How would this be useful? -- Andrei
>> 
>> Really just an additional convenience, instead of writing 
>> slice[0..$, 0..$, 0..$, i], you would write slice[.., .., .., 
>> i].
>
> The result looks pretty awful. We save two characters per 
> dimension to get Morse code. -- Andrei

This is based on the Matlab colon operator. The .. was intended 
to keep it consistent with D's syntax.
https://www.mathworks.com/help/matlab/ref/colon.html

There was also a suggestion at mir-algorithm for allowing 
something like slice[0..2..$]
https://github.com/libmir/mir-algorithm/issues/53
Again, the same idea could be expressed with the colon operator.


More information about the Digitalmars-d mailing list