[fpc-devel] (ref types / circles) Re: Defer keyword

Ryan Joseph genericptr at gmail.com
Sat May 8 19:38:49 CEST 2021



> On May 8, 2021, at 11:18 AM, Sven Barth <pascaldragon at googlemail.com> wrote:
> 
> It's not about reference counted classes vs. managed records, but about whether it's *per type* or *per variable*, the implementation details are completely irrelevant for now.

So the biggest concern you see if that classes are easier to assign to non-reference counted classes? The only difference between classes and records in this regard is that records give errors unless you assign directly to the same record type, where classes can be assigned to super-classes which may not be managed.

As you say there would need to be at least a warning if you cast a managed class to another class type or make it forbidden completely. I don't see that as a deal breaker personally but you seem to feel pretty strongly about it.

Anyways I wrote up a little wiki with some potential implementation notes about a default property (which overlaps on the "defaults implements" as traits stuff). Important points are restricting what types can be default properties (classes and maybe/probably typed pointers) and limiting hoisting to subscripting, so it's kind of like the -> operator overload in C++.

https://github.com/genericptr/freepascal/wiki/Default-property

Regards,
	Ryan Joseph



More information about the fpc-devel mailing list