I suggest we ...

Allow record inheritance / multiple "inheritance"

I propose to add multiple ***fields*** inheritance into records:

type Person =
{ First: string
Last: string }

type Foo = { Bar: int }

type Student =
inherit Person
inherit Foo
{ GPA: float }

let student = { First = "a"; Last = "b"; Bar = 2; GPA = 1.0 }

Making the same thing with composition results with not such an elegance flat records.

This approach is used, for example, in Nitra AST DSL, see https://github.com/rsdn/Nitra-Mini-C/blob/master/Nitra-Mini-C/MiniC-ast.nitra#L94

17 votes
Sign in
Password icon
Signed in as (Sign out)
You have left! (?) (thinking…)
Vasily Kirichenko shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Password icon
Signed in as (Sign out)

F# Language

Feedback and Knowledge Base