Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-11

Variant part in objects?

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ryan Joseph

Is there a reason that objects don't support variant sections like with records? Maybe they mess with the VMT table when virtual methods are added?

I just posted my "advanced objects" patch (https://bugs.freepascal.org/view.php?id=36350) and all it does is add "class operators" to objects but I was curious about the variant records because it appears to be the only other thing from records that aren't in objects.

Regards,
Ryan Joseph

Gerhard Scholz
to Ryan Joseph

Do it like this:

type obj = object
                   vars : record
                                case boolean of
                                 ....
                              end ;
                  end ;
Earlier message 25 lines
----- Original Message ----- From: "Ryan Joseph via fpc-pascal" To: "FPC-Pascal users discussions" Cc: "Ryan Joseph" Sent: Sunday, November 24, 2019 3:18 PM Subject: [fpc-pascal] Variant part in objects? > Is there a reason that objects don't support variant sections like with > records? Maybe they mess with the VMT table when virtual methods are > added? > > I just posted my "advanced objects" patch > (https://bugs.freepascal.org/view.php?id=36350) and all it does is add > "class operators" to objects but I was curious about the variant records > because it appears to be the only other thing from records that aren't in > objects. > > Regards, > Ryan Joseph > > _______________________________________________ > fpc-pascal maillist - > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal >