> On May 26, 2019, at 5:50 PM, Kostas Michalopoulos <badsectorac...@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.

Regards,
        Ryan Joseph

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to