[fpc-devel] Object upgrades

Ryan Joseph ryan at thealchemistguild.com
Mon May 27 00:08:32 CEST 2019

> On May 26, 2019, at 5:50 PM, Kostas Michalopoulos <badsectoracula at gmail.com> wrote:
> Do records support inheritance in next FPC? 3.0.4 doesn't seem to
> allow that and this is the main reason i use objects when i need value
> types.

No, only objects. Objects don’t have operator overloads though so they can’t be used in some cases. Of course records could support inheritance but I think that’s even more contentious (and instrusive to the compiler) than adding operator overloads to objects.

> Actually, what are the differences between records and objects that
> make it impossible for records to get objects' features or objects to
> get records' features so there is no difference between the two and
> one become alias for the other?

Records don’t have a VMT table and overriding but otherwise they’re the same afaik (constructors don’t work the same also). Operator overloads simply aren’t enabled for objects because apparently they’re a legacy syntax but as you pointed out they’re still useful. Being able to use subclassing for TVec2 -> TVec3 -> TVec4 objects would be really useful. I hope the compiler team reconsiders this.

	Ryan Joseph

More information about the fpc-devel mailing list