[Issue 2058] New: Describe hidden value passed to class member functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 29 12:57:30 PDT 2008


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

           Summary: Describe hidden value passed to class member functions
           Product: D
           Version: 2.012
          Platform: PC
               URL: http://www.digitalmars.com/d/2.0/class.html
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: jlquinn at us.ibm.com


As in C++, D appears to implicitly pass a reference to the class instance into
a call to a member function to support references to class member vars and
"this".

The fact that a hidden var is passed in is documented in reference to nested
classes, but not for basic member functions.

This behavior is likely well known to experienced c++ developers, but needs to
be documented in a language spec.

I ran into this trying to pass a class member function into
std.algorithm.lowerBound, which of course doesn't work because of the hidden
class reference.  (There needs to be a way to pass a member function in easily
- subject for another bug).


-- 



More information about the Digitalmars-d-bugs mailing list