complement to $

bearophile bearophileHUGS at lycos.com
Fri May 14 13:53:36 PDT 2010


Ali Çehreli:
> $ has always bugged me anyway, so how about no character at all:

The $ is not elegant, but it's a good solution to a design problem, how to represent items from the bottom of the array. In Python you write:
a[-5]
In D you write:
a[$-5]

This small one-char difference has an important effect for a system language: the presence of $ allows you to avoid a conditional each time you want to access an array item :-)
So I think it as one of the smartest details of D design :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list