> They list two reasons to make your class final.  One is security
> (which might actually be valid, but I doubt it will hold up to
> determined attack), the other though...
> 
>     You may also wish to declare a class as final for object-oriented
>     design reasons. You may think that your class is 
> "perfect" or that,
>     conceptually, your class should have no subclasses.
> 
> The idea that a class is either 'perfect' or 'complete' has to be the
> silliest, most arrogant thing I've ever heard!

The only good justification I've heard for "final" is as a directive
for optimization. If you declare a variable to be of a final type, then
the compiler (JIT, or whatever) can resolve method dispatch at
compile-time. If it is not final, then the compiler can make no such
assumption because java code can load in extra classes later.

However, there are probably some advanced techniques that allow
optimization even when there is no "final". Remembering where
optimizations were done, and undoing them if necessary, is one
possibility. Perl would find this more difficult (there are many
more ways to mess with the type system), so a "final" property
may actually be useful.

> Anyhow, just don't anyone suggest putting this in Perl 6.  I know
> where you live.

Uh Oh :)


Dave
--
Dave Whipp, Senior Verification Engineer,
Fast-Chip inc., 950 Kifer Rd, Sunnyvale, CA. 94086
tel: 408 523 8071; http://www.fast-chip.com
Opinions my own; statements of fact may be in error. 

Reply via email to