RFC on range design for D2

Bill Baxter wbaxter at gmail.com
Tue Sep 9 17:11:47 PDT 2008


On Wed, Sep 10, 2008 at 8:04 AM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:

> Finally the coin dropped on the Arabic/Hebrew cultural thing. I don't think
> they'd be offended. This is not writing. Left is left and right is right in
> math.

Also the direction in which D code is written does not depend on the
language of the speaker.  It's always left to right.
So I think there's no real argument on linguistic grounds.

On the other hand, a quick google for "left right confusion" turns up
a fair number of relevant hits.  There's enough people out there who
have trouble keeping those directions straight for it to get
discussed.  Searches for "begin end confusion", "front back
confusion", "first last confusion" predictably turned up no relevant
hits I could find.

> But yes... first and last are in I guess. I'd also like *r as a shortcut for
> r.first, as it will be no doubt used very intensively.

Recognizing that the typical usage for these things will be that
"first" is the current value and "last" is actually a bogus sentinel,
I guess I would rather see something like .value or .item for the
current value.  I can understand the pull to try to make the names
symmetric, but in fact the things they represent are not really
symmetric, so I don't see it as a  requirement that the names be
symmetric.

And opStar is hard to search for so I'd rather not see that at all.
Note also that if you declare that * is an alias for .first in the
ranges interface that means that every implementor of a range will
have to remember include that alias.

--bb


More information about the Digitalmars-d-announce mailing list