[Issue 7177] $ should forward to length by default

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 2 07:47:22 PDT 2013


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



--- Comment #67 from Andrei Alexandrescu <andrei at erdani.com> 2013-04-02 07:47:20 PDT ---
(In reply to comment #66)
> (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.

I agree this is a good counter-argument to my proposed approach.

> > https://github.com/9rnsr/dmd/branches/fix7177alt
> > https://github.com/9rnsr/phobos/branches/fix7177alt
> 
> https://github.com/9rnsr/phobos/commit/dd0d4c139828013c34e76acc74884341f31db298#L0R1326

I think this is a good compromise. Unless there are other issues found by
others, I agree moving forward with this. More thoughts?

-- 
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