Pointers to non-static member functions!

Michel Fortin michel.fortin at michelf.com
Wed Jun 8 11:41:29 PDT 2011


On 2011-06-08 14:13:46 -0400, Michel Fortin <michel.fortin at michelf.com> said:

> I won't disagree with anything you say, because I do agree. I know my 
> use case is a fringe one, and I don't need it anymore so I don't care 
> much. And it'd only need one small thing for it to work without all 
> that cumbersome hack:
> 
> 	o.memberFunc() // where methodFunc is an alias to a member of o
> 
> which probably shouldn't be that difficult to implement in the 
> compiler, what's needed is new syntax to distinguish it from a normal 
> member call. Perhaps this?
> 
> 	o.(memberFunc)()

Now that I think about it, perhaps UFCS would make all this unnecessary.

	void callMe(alias memberFunc)(Object o) {
		o.memberFunc(); // error, no member called "memberFunc" in o
		memberFunc(o); // works?
	}


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list