why $ is need to access array [negative index]?
mingwu at gmail.com
Fri Sep 18 19:53:41 UTC 2020
In Python it's such a convenience to be able to access array
element from the end:
in D, we can do that too, but need an extra $: arr[$-1]
I'm porting some code from Python to D:
int signs; // sign: -1, 0, 1
int sign = -1; // for example
writeln(signs[sign]); // Range violation
// Error: array index 18446744073709551615 is out of bounds
signs[0 .. 3]
(yes, I know I can use AA, int[int], but it just make things
Can we have a DIP remove / make optional `$` in this usage?
More information about the Digitalmars-d