[fpc-pascal] Traits Proposal

Ryan Joseph genericptr at gmail.com
Wed Feb 10 20:41:41 CET 2021



> On Feb 10, 2021, at 12:17 PM, Ryan Joseph <genericptr at gmail.com> wrote:
> 
> Thinking about this more I don't think there's even a reason for it since Object Pascal doesn't let you do stuff like this anyways. If you want to call the super class you need to use "inherited" from within the class body.  The example I posted only works if there is no virtual/override involved.

Also, PHP doesn't have function overloading so they need to add all these complicated conflict resolution syntaxes into their implementation. For Pascal we don't have this problem and we can simply rely on the existing rules. The only exception is when you override a method that is implemented as a trait (see the "Overrides" section in the wiki). We may not even want to allow this because it's an edge case that could be resolved by explicit references. Traits can be VERY simple if we keep it that way.

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list