Open blowin opened 4 years ago
I think this would be interesting to explore. This kind of stuff is always kind of tricky, but if it's possible and non-breaking (at least in normal usage) then it'd be worth doing.
The assumption is that for every use case the memory savings outweigh the casting overhead, even when there are 2 cases? Since this only changes the internal representation and FSharp.Core/reflect.fs isn't affected (the public properties for case reading and construction won't change), could it conceivably break anything else?
By the way, what's the purpose of that (https://github.com/dotnet/fsharp/issues/9767) and why isn't the tag baked into every constructor? P_2
constructor parameter
This is covered by https://github.com/fsharp/fslang-suggestions/issues/699 and other suggestions.
We should use Explicit overlapping layouts where possible
This optimization will reduce the size of the struct.
Generate C# code
replace 3 field with 1 field