Replies: 3 comments 6 replies
-
This will be useful if DUs are based on records as I think it would be expected that empty cases of a DU are singletons. This should only apply to an empty positional record without any parameters or fields. An alternative is something like Scala's |
Beta Was this translation helpful? Give feedback.
-
Having |
Beta Was this translation helpful? Give feedback.
-
If this was implemented, what would happen if a record explicitly overrode equality to use reference equality? record R
{
public virtual bool Equals(R other) => ReferenceEquals(this, other);
public override int GetHashCode() => RuntimeHelpers.GetHashCode(this);
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This was considered before but seems to be discarded silently.
A record is identified by a set of fields together with value semantics, meaning an empty record is practically a singleton and it could actually be implemented as such e.g.
new EmptyRecord()
would return the same instance everywhere.Beta Was this translation helpful? Give feedback.
All reactions