Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No mutable fields in message records #236

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

webwarrior-ws
Copy link
Contributor

Fixes #87
Made ILightningSerializable<'T>.Deserialize method return
deserialized object instead of mutating this instance.
Removed mutable modifier from all record fields in message types.

Made ILightningSerializable<'T>.Serialize method return
deserialized object instead of mutating `this` instance.
Removed `mutable` modifier from all record fields
Added DummyInstanceHolder class for holding
ILightningSerializable<'T> instances used for deserialization.
Added comment describing why this workaround as well as
[<CLIMutable>] annotations on records are needed.
Copy link
Owner

@joemphilips joemphilips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM. Interesting hack.
You are correct that all these mess in deserialization is caused by the lack of static abstract members. But probably we cannot use it in the future even after F#7 gets stable, for the backward compatibility reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deserialize method should not return unit
2 participants