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

Default-value annotation #646

Open
malcolmredheron opened this issue Jan 3, 2025 · 0 comments
Open

Default-value annotation #646

malcolmredheron opened this issue Jan 3, 2025 · 0 comments

Comments

@malcolmredheron
Copy link

As I understand it, the intended procedure when adding a field to a case class that I have serialized with upickle is to give it a default value, so that I can continue to read old data

However, if I do this then I lose type safety, since all of my existing code, which doesn't pass the value, still compiles. So I have to define a matching object for the case class, with an apply() method that has all the same arguments and passes them through. It's a bit of a drag

Would you consider an annotation that provides the default value? Or is there some other way to do what I'm trying to do?

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

No branches or pull requests

1 participant