Jump to page: 1 2
Thread overview
[Issue 8114] New: Methods are delegates, not functions.
May 19, 2012
Walter Bright
May 19, 2012
Stewart Gordon
May 19, 2012
Stewart Gordon
May 19, 2012
Stewart Gordon
May 19, 2012
Stewart Gordon
May 19, 2012
Stewart Gordon
May 20, 2012
Stewart Gordon
May 20, 2012
Stewart Gordon
Oct 28, 2012
yebblies
May 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8114

           Summary: Methods are delegates, not functions.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: wfunction@hotmail.com


--- Comment #0 from wfunction@hotmail.com 2012-05-18 11:34:43 PDT ---
class Test
{
    public void foo() { }
}

static assert(is(typeof(&Test.foo) == void function()));

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


Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schveiguy@yahoo.com
         Resolution|                            |INVALID


--- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-05-18 12:06:24 PDT ---
As horrible as this is, it's intended behavior :)  It's the same type you would get if you obtained the funcptr property of a delegate to the same member function.

Changing to invalid, if you want to propose a different way to handle it, reopen as an enhancement.

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


wfunction@hotmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


--- Comment #2 from wfunction@hotmail.com 2012-05-18 13:56:26 PDT ---
I understand what you mean, but if that's the case, then the intentional behavior itself is a bug.

The *correct* way to achieve what was intended would be to add the 'this' parameter inside the parameter list. Otherwise, it results in buggy code, since the data type of the function doesn't match what it's pointing to.

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


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2012-05-18 20:25:43 PDT ---
Why is this 'critical'?

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



--- Comment #4 from wfunction@hotmail.com 2012-05-18 20:57:40 PDT ---
I put it as critical since it seemed looked like a bug in DMD (I'd never seen it before and it didn't make sense), but when people said it was intentional I forgot to change the status after re-opening it. I'll make it normal.

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


wfunction@hotmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


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


Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, spec
                 CC|                            |smjg@iname.com


--- Comment #5 from Stewart Gordon <smjg@iname.com> 2012-05-19 04:31:01 PDT ---
http://dlang.org/type.html#delegates
"There are no pointers-to-members in D"

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



--- Comment #6 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-05-19 08:28:48 PDT ---
(In reply to comment #5)
> http://dlang.org/type.html#delegates
> "There are no pointers-to-members in D"

I think this specifically refers to C++ pointers-to-members which these are not

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



--- Comment #7 from Stewart Gordon <smjg@iname.com> 2012-05-19 08:34:24 PDT ---
(In reply to comment #6)
> (In reply to comment #5)
> > http://dlang.org/type.html#delegates
> > "There are no pointers-to-members in D"
> 
> I think this specifically refers to C++ pointers-to-members which these are not

What's the difference?

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



--- Comment #8 from Stewart Gordon <smjg@iname.com> 2012-05-19 08:36:13 PDT ---
Moreover, I would expect "There are no pointers-to-members in D" to mean "There are no pointers-to-members in D" not "There are pointers-to-members in D, but they aren't of the C++ sort".

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