[fpc-pascal] Traits Proposal

Ryan Joseph genericptr at gmail.com
Wed Feb 10 22:42:22 CET 2021



> On Feb 10, 2021, at 1:51 PM, Martin Frb via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> I don't have a pro/contra agenda on whether that feature should be part of the fpc trait or not.
> I just saw it, and thought I raise it.
> 

These issues you are raising are more related to general type safety/compatibility and probably beyond the scope of what traits should do. It also introduces lots of new concepts and syntax which make this exponentially more unlikely to get approved.

The only purpose of the trait is import fields/methods into a namespace of a struct, like multiple inheritance but with references. We should keep it as simple as possible imo.

> ----------------------
> Btw, next question that just came up
> 
> Will traits only apply to classes?
> 
> or could a record / advanced record / old object also receive traits ?
> 

I don't see why not but nothing is settled yet.

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list