Language-ext: Could [Record] create a factory method (New)?

Created on 29 Jan 2020  路  3Comments  路  Source: louthy/language-ext

This is a feature request:

NewType<> gives us static New method and [Union] generates a MyUnionTypeCon factory for creating instances using a static method. [Record] just generates a constructor.

Can we have some static factory method with [Record], e.g. MyRecordType.New(....)?

Most helpful comment

Deployed in v3.3.51

All 3 comments

The only issue is possible clashes with field names, although I鈥檇 say this is the least problematic, so yes it seems reasonable. The main reason for a separate static class was to make the use of generics easier, so perhaps non-generic Records could drop the static class and use New instead.

Just realised my mistake (sorry, our to lunch and wasn鈥檛 paying proper attention); ignore my comments about the static class, yes we can have a New method

Deployed in v3.3.51

Was this page helpful?
0 / 5 - 0 ratings

Related issues

khtan picture khtan  路  4Comments

jcoder58 picture jcoder58  路  5Comments

jwilliamson1 picture jwilliamson1  路  7Comments

michael-wolfenden picture michael-wolfenden  路  5Comments

buinauskas picture buinauskas  路  4Comments