--- Comment #3 from Jacob Carlborg <> 2010-08-07 07:01:32 PDT ---
(In reply to comment #2)
> I'm not sure.  The existence of .funcptr seems to contradict
> "There are no pointers-to-members in D, but a more useful concept called
> delegates are supported."

Just after that it says: "Delegates are an aggregate of two pieces of data: an
object reference and a function pointer.". You must always have a pointer to a
member, then you add a context and gets a delegate. How about static members,
you can have pointers to those, regular function pointers. I don't know why the
docs are written like that. Probably because the concept is a little different
compared to C++'s member pointers. D's delegates are basically just syntax
sugar for a C++'s member pointer and a instance of the same class.

> See also bug 2557.
> Applies to D1 as well, though new A must be cast.  Moreover, you don't need to
> go through an alias - DMD 1.062 accepts even
>     dg.funcptr = &;

I used an alias because an alias was used in the first example.

> But non-static members of structs/classes/unions are still compile-time
> entities, and they have properties.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to