Is there a recommended way to simulate multiple levels of inheritance in F #, presumably using a discriminated union?
Something like the following in C #:
class Expr { } class SourceExpr : Expr { } class JoinExpr : SourceExpr { } class TableExpr : SourceExpr { }
I did this in F #:
type SourceExpr = | Join of JoinExpr | Table of TableExpr type Expr = | Source of SourceExpr | ...
Is there a better way? Does this have the same polymorphic behavior as inheritance?
. , , (DU). / - , "", DU "". , ( ) . , DU (, ), () , , ( " ".)
, DU, ; , , . , , ; (), , (Draw, Resize,...), .
F # , #.... ... , .
, , , , , , .
, F # #... UNLESS.... .
- ... .
... .... , .... .