in reply to A class that cannot be subclassed.
You can make a class that would be useless to subclass. Just put all instance data in lexicals (i.e. Inside-Out) and check the ref() of $self at each method invocation.
In any case, having a class that can't be subclassed is completely useless by itself. As far as I can see the only reason it's even possible to define such classes in some languages is that under certain circumstances the compiler/runtime can optimize calls - it doesn't have to support (as much) polymorphism.
|
|---|