f# - How to specify a self return type -
i've got abstract class called "recorda" slicing logic want subclass couple of classes. want "record" define abstract slice method must implemented return it's own type, e. g. type "recordb" when sliced returns recordb type.
is possible in fsharp? if not, why not?
the way interface have method returns different type depending on concrete class make parametric:
type record<'concrete> = abstract member slice : unit -> 'concrete type recordb() = interface record<recordb> member this.slice() = new recordb()
Comments
Post a Comment