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

Add assemble methods in Courier record companions that use field inclusion #39

Open
josh-newman opened this issue Nov 4, 2016 · 1 comment

Comments

@josh-newman
Copy link
Contributor

Right now, records that use field inclusion have the standard two construction methods in their companion (building from DataMap and with all fields specified explicitly). I think it'd be useful to add additional methods, perhaps called assemble, that accept the included arguments as records instead of individual fields. For example:

record A {
  field1: int
  // many others
}

record B {
  ...A
  fieldB: string
}

I'd like to construct B with B.assemble(A(...), "fieldB"), instead of B(1, ..., "fieldB").

For records with multiple inclusions, I think generating a single assemble that accepts all included records plus all additional fields is sufficiently useful (rather than worrying about the complexity of overloads for different inclusion combinations).

@marcgrr
Copy link
Contributor

marcgrr commented Apr 25, 2017

+1

Also, some opposite disassemble (or deconstruct or unapply) methods would be useful and they would have prevented the example bug that I describe in #60 .

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

2 participants