http://d.puremagic.com/issues/show_bug.cgi?id=7177
--- Comment #34 from [email protected] 2013-03-21 14:32:09 PDT --- (In reply to comment #32) > (In reply to comment #31) > > Needing to state in the template constraint that a type supports syntax > > sugar > > appears to be sub-optimal at best. (Whether or not it is used will usually > > be > > an implementation detail.) IMO adding opDollar using UFCS makes the most > > sense. > > I think the mistake here is the assumption that $ is syntax sugar. opDollar > is > a function, and is not required to return length, otherwise we wouldn't be > having this discussion. > > A more semantically named trait would be hasEnd. Ok. Still, a finite RandomAccessRange should always satisfy hasEnd. opDollar is syntax sugar. I do not think there is a halfway decent API where opDollar is not an alias to a more aptly named member. For ranges, it is length, for dcollections, it might be end, etc. If opDollar is not considered syntax sugar, you have: auto end = m.opDollar(); However, why does it even make sense to make opDollar denote end? There is no analogue for begin. m[m.begin()..m.end()] ... m[m.begin()..$] ... uh. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
