On Sat, 15 Jan 2022, Ryan Joseph via fpc-pascal wrote:

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 think Scala did it before Swift.


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.

This idea has been proposed before by Izak Maciej. I'm all for it.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to