Stefan Behnel wrote:
> Robert Bradshaw, 07.01.2010 22:06:
>> The inline keyword is nice because we already use it for functions  
>> (where the final keyword makes no sense). I think it's probably worth  
>> introducing both keywords, where inline would control emission of the  
>> C inline directive. (Of course for non-inline final methods, the C  
>> compiler could decide whether or not to actually inline.) A class  
>> could be final, with the same semantics as java. One question is would  
>> inline imply final, or require it?
> 
> It makes no sense without final, so it should imply it (and certainly not 
> require it).

Actually, in code like this

a = MyClass()
a.foo()

the compiler would be able (in theory) to infer the exact type of "a" 
and treat any method calls on it as final (skip vtable), and then 
whether INLINE is declared or not C-side is an orthogonal issue.

I.e. "cdef inline foo(self)" could mean "allow overriding the method, 
but make it inline in situations where the vtable can be skipped".

Not that I think there's a real use for this...

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to