I saw a new syntax in Swift which I thought was clever and fits a pattern I've
seen before. Basically it's a case statement for class types which lets you
branch depending on which class type the class instance is at run time.
I wonder if this could be implemented in FPC? The syntax would be kind of
clumsy though since you can't declare scoped variables in Pascal so you would
need to do lots of casts but it's still cleaner than the equivalent code as if
statements.
=====================
case monster of
TZenChan:
TZenChan(monster).DoThis;
TPulPul:
TPulPul(monster).DoThat;
otherwise
monster.DoSomething;
end;
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal