mixins as inline functions
Walter Bright
newshound at digitalmars.com
Fri Aug 18 19:50:53 PDT 2006
Serg Kovrov wrote:
> Walter Bright wrote:
>> Serg Kovrov wrote:
>>> First time I looked at mixins in D reference, I thought that it could
>>> be used as inline function. Like a big C macro. But better =)
>>>
>>> It has its own scope, it has access to parent scope, everything seems
>>> fit. Except that in mixins it is not possible to use assign
>>> operations. Could this restriction be removed in future? Is there any
>>> plans for mixins evolution?
>>
>> Why not just use inline functions?
>
> Er... Because there is no inline functions? =)
All functions are candidates for inlining.
> But if seriously, does virtual methods (accessing 'this') can be inlined?
Functions accessed through the virtual function pointer table cannot be
inlined. Mixins can't fix that. To access a function directly, rather
than through virtual dispatch, declare it to be 'final'.
More information about the Digitalmars-d
mailing list