[Issue 7177] $ should forward to length by default

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 2 04:30:37 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=7177



--- Comment #66 from Kenji Hara <k.hara.pg at gmail.com> 2013-04-02 04:30:35 PDT ---
(In reply to comment #65)
> BTW disabling opDollar should mean "pass through". Consider:

I think it would introduce one more "special case" in operator overloading
mechanism. I hate special rules.

> > As far as I understand it, his proposal is to restrict $ to ranges.
> > 
> >     auto ref opDollar(R)(auto ref R r) if (isInputRange!R && hasLength!R) {
> >         return r.length;
> >     }
> > 
> > std.range vs. object.d is a separate issue.
> 
> Is that correct, Kenji? (I don't think we should mix ranges into this without
> necessity.)

Yes. It is correct. See my experimental implementation.

> https://github.com/9rnsr/dmd/branches/fix7177alt
> https://github.com/9rnsr/phobos/branches/fix7177alt

https://github.com/9rnsr/phobos/commit/dd0d4c139828013c34e76acc74884341f31db298#L0R1326

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list