Asking types about their traits (D 1.0)

Jarrett Billingsley kb3ctd2 at yahoo.com
Sun Feb 10 21:08:51 PST 2008


"Burton Radons" <burton-radons at shaw.ca> wrote in message 
news:fooeas$1lkd$1 at digitalmars.com...
>
> That seems the incorrect type though; it should be "T function (T, inout 
> T)", which works correctly. The only problem with that is that variadic 
> functions would be "T function (..., inout T)", which actually makes sense 
> to the ABI (that implementations must conform to), so why not allow it, at 
> least for types? It would definitely be an easier solution than any 
> C++-style member-function nonsense.

I guess what you're getting at is that you would expect the parameter list 
to include the "this" pointer?

The thing is that a delegate does not use the same calling convention as a 
normal function, so there's no way to implicitly convert between the two 
without thunking.  It's why the 'this' pointer is not included in the 
parameter list of the address of a member function.  That function pointer 
is just half of what you need to call it, the other half of course being the 
object to call it on.

Another point to consider is that GDC doesn't use the same calling 
convention as DMD, so where the 'this' pointer is passed might be / probably 
is different. 




More information about the Digitalmars-d-learn mailing list