Jump to page: 1 2
Thread overview
[Issue 8113] New: alias this doesn't forward opCall
[Issue 8113] alias this and opDispatch() don't forward opCall
May 18, 2012
Kenji Hara
May 18, 2012
Kenji Hara
May 18, 2012
Kenji Hara
May 20, 2012
Kenji Hara
May 20, 2012
Kenji Hara
May 21, 2012
Walter Bright
May 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8113

           Summary: alias this doesn't forward opCall
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: wfunction@hotmail.com


--- Comment #0 from wfunction@hotmail.com 2012-05-17 11:26:53 PDT ---
And, in fact, opDispatch doesn't do that, either.

Both of them should treat opCall like a normal member.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8113



--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-17 20:35:54 PDT ---
Please give us an actual and possible reduced code. otherwise, this might become useless report.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8113



--- Comment #2 from wfunction@hotmail.com 2012-05-17 21:34:38 PDT ---
struct C { void opCall() { } }
struct A { C c; alias c this; }
void main() { A f; f(); }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8113



--- Comment #3 from wfunction@hotmail.com 2012-05-17 21:36:14 PDT ---
And regarding opDispatch:

struct C { void opDispatch(string op, T...)(T) { } }
void main() { C f; f(); }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8113


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-17 21:47:32 PDT ---
(In reply to comment #2)
> struct C { void opCall() { } }
> struct A { C c; alias c this; }
> void main() { A f; f(); }

Hmm, thank you. I'll try to fix the issues this weekend.

(In reply to comment #3)
> And regarding opDispatch:
> 
> struct C { void opDispatch(string op, T...)(T) { } }
> void main() { C f; f(); }

I'm not sure this is valid. With current implementation, opDispatch cannot forward operator overloading like f.opDispatch!"opUnary". I think this is an enhancement issue about opDispatch feature. Creating new issue is better IMO.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8113



--- Comment #5 from wfunction@hotmail.com 2012-05-17 22:21:32 PDT ---
Thanks.

Just wondering, why is the second one an 'enhancement'? Isn't opUnary just a member, which should also be opDispatch'ed?

(I'm figuring that the only members which should not be opDispatch'able are: opDispatch itself, the constructors, and the destructor. Anything else, by definition, is dispatched on the object.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8113



--- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-17 23:04:02 PDT ---
(In reply to comment #5)
> Thanks.
> 
> Just wondering, why is the second one an 'enhancement'? Isn't opUnary just a member, which should also be opDispatch'ed?

Today these forwarding doesn't work at all.

struct S { void opDispatch(string op, A...)(A args){} }
void main() {
    S s;
    +s;     // not converted to opDispatch!("opUnary", ...)
    s + s;  // not converted to opDispatch!("opBinary", ...)
    s();    // not converted to opDispatch!("opCall", ...)
}

So I think this is an enhancement rather than a bug.

> (I'm figuring that the only members which should not be opDispatch'able are: opDispatch itself, the constructors, and the destructor. Anything else, by definition, is dispatched on the object.)

I think no. At least, constructor and destructor have some special features (e.g. can modify const members for construction), but opDispatch doesn't.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8113



--- Comment #7 from wfunction@hotmail.com 2012-05-18 00:42:50 PDT ---
(In reply to comment #6)
> Today these forwarding doesn't work at all.

lol I imagined that was the bug. I guess you could call it the lack of a feature too haha.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8113


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|alias this and opDispatch() |alias this doesn't forward
                   |don't forward opCall        |opCall


--- Comment #8 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-19 20:09:40 PDT ---
I separated issues about opDispatch.

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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8113


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #9 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-19 20:13:01 PDT ---
https://github.com/D-Programming-Language/dmd/pull/956

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2