why $ is need to access array [negative index]?

mw mingwu at gmail.com
Fri Sep 18 21:06:22 UTC 2020


On Friday, 18 September 2020 at 21:02:11 UTC, bachmeier wrote:
>> in D, to write the same code, you have to test the sign and 
>> branch:
>>
>> if (sign >= 0) {
>>   signs[  sign] = ...;
>> } else {
>>   signs[$+sign] = ...;  // remember + here
>> }
>
> I'm confused. The justification for a major language change 
> would be convenience of porting Python code to D?

You are indeed confused: the justification is either compiler 
writes that branching code, or user have to write it.


More information about the Digitalmars-d mailing list