Re: Pre-PPC: class :abstract

[email protected] (Ovid)
Newsgroups perl.perl5.porters
Message-ID <CA+M4CHtq+YJi5+vn0D+EjK1iRAPru8f2XhKezNtCSqaoWoNkig@mail.gmail.com>
On Wed, Dec 17, 2025 at 3:47 PM Branislav Zahradník <[email protected]>
wrote:

>
>
> On Wed, 17 Dec 2025 at 15:38, Paul "LeoNerd" Evans <[email protected]>
> wrote:
>
>
I always though that abstract has same usefulness as Java's final - hardly
> to be distinguished from zero.
>

Final classes can be interesting. In some languages, you no longer have to
use a vtable to lookup methods, meaning you get a nice performance boost.
It's also useful when you have extremely sensitive classes (e.g.,
something security related) which you don't want people to change without
careful consideration. It also makes it impossible to violate Liskov :)

I wouldn't reach for final classes as a first solution, but they're not
without merit. It's just that the use cases are somewhat restricted (though
our inability to enforce Liskov might be an argument).

For abstract classes, they have uses, too, such as being the base class for
a factory and ensuring that every factory class has the required interface.
They do have one notable fragility, though. If you add a new abstract
method, all subclasses are immediately broken until they can be updated.
Maybe not so bad for closed source work, but bad for open source.

Best,
Ovid
-- 
https://curtispoe.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.