[fpc-devel] class abstract, class sealed implementation. please review.

Florian Klaempfl florian at freepascal.org
Sun Oct 18 21:05:59 CEST 2009


Jonas Maebe schrieb:
> Florian Klaempfl wrote on Sat, 17 Oct 2009:
> 
>> Graeme Geldenhuys schrieb:
>>> 2009/10/16 Paul Ishenin <webpirat at mail.ru>:
>>>> Sealed class is a class which can't be derived by another class.
>>>> This one is
>>>> fully supported by delphi.
>>>
>>> Would you mind explaining this - I never saw the benefit of a sealed
>>> class.
>>
>>> From a compiler developers point of view, it makes optimization easier
>> under certain cases (e.g. virtual method calls).
> 
> FPC can already do this automatically for all classes in the entire
> program with whole-program optimization. You don't need sealed classes
> for this (they might slightly improve those optimizations, but I doubt
> it will be noticeable in real life -- even doing it for an entire
> program using WPO generally has no noticeable effects on speed, and only
> marginal effects on code size).

True. But sealed requires no recompilations to do the optimization, so
it works always.



More information about the fpc-devel mailing list