Member function pointers
Michel Fortin
michel.fortin at michelf.ca
Mon Jun 10 07:28:48 PDT 2013
On 2013-06-10 14:11:31 +0000, "David Nadlinger" <code at klickverbot.at> said:
> On Monday, 10 June 2013 at 14:04:29 UTC, Manu wrote:
>> On 10 June 2013 23:46, David Nadlinger <code at klickverbot.at>
>>> Another less intrusive option would be to just add extern(CppThisCall) and
>>> extern(DThisCall) or something along the lines, which would be specified to
>>> pass the first parameter as if it was a this pointer.
>>
>> That would also do the business. Do you think that's less intrusive?
>
> Less intrusive in the way that it is a minimal addition to the language
> itself (we already have several calling conventions), whereas your
> suggestion would require adding a special case to the grammar.
>
> That's not to say I don't like your proposal, though. I just wanted to
> put the option on the table to be sure we are getting somewhere with
> this, even if some people might be opposed to the grammar change. This
> issue has been bugging me for quite some time as well.
It's inelegant, but it could work.
I just find it sad that we have to use a different calling convention
for member functions. I mean, it'd be much more elegant be if a member
function could simply be called from a "void function(Object)" by
supplying "this" as the first argument? Wouldn't it be better to adapt
the ABI to fit the language rather than adapt the language to fit the
ABI?
--
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca/
More information about the Digitalmars-d
mailing list