why $ is need to access array [negative index]?
mingwu at gmail.com
Fri Sep 18 21:17:55 UTC 2020
On Friday, 18 September 2020 at 21:14:19 UTC, mw wrote:
> On Friday, 18 September 2020 at 21:11:58 UTC, Steven
> Schveighoffer wrote:
>> Well, if you don't care about verbosity.
>> signs[(sign + $) % $] = ...;
> I want compiler writes this verbosity, instead of the user :-)
And ... this [(sign + $) % $] is not right, it's defensive
programming: and will hide real bugs, e.g.
when array index > array.length.
See how easy user code contains bugs. The compiler should really
do the hard work to make programmer's life easier.
More information about the Digitalmars-d