why $ is need to access array [negative index]?
bachmeier
no at spam.net
Fri Sep 18 21:02:11 UTC 2020
On Friday, 18 September 2020 at 20:56:30 UTC, mw wrote:
> On Friday, 18 September 2020 at 20:48:47 UTC, bachmeier wrote:
>> I'm inclined to say typing a single character is not a
>> hardship in exchange for extreme clarity of the code. Keep in
>> mind that
>
> It not about saving "typing a single character".
>
> In the example I showed,
>
> signs[sign] = ...; // the sign can be -1, 0, 1
>
> 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?
More information about the Digitalmars-d
mailing list