On Sun, 14 Feb 2021, Sven Barth via fpc-pascal wrote:

So whether it be this, or just an improvement on the Interfaces we already have, I'd definitely personally be in favor of something that "works like Interfaces except minus the negative performance implications."

There are no significant performance implications of interfaces. They're essentially a virtual method call, something that one is doing all day long with Object Pascal classes.

I think the "performance implications" is more referring to memory management.

Interfaces means an extra object per interface, so more objects on the heap with all the extra memory management that implies.

That is why I think that a 'trait' using an object/advanced record has it's advantage: There is only 1 continuous memory block for a class implementing
traits.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to