Open cvogt opened 9 years ago
Overlap is sometimes perfectly valid. Requiring users to rename their records could be a too big burden. Maybe you can introduce a default scheme for resolving conflicts.
@vjovanov I am thinking to have one operator that simple overrides and one that fails on conflicts. I don't think I like automatic conflict resolution that alters the structure. Maybe if it is demanded at some point. For now I am just planning to add a way to actually RENAME fields: https://github.com/cvogt/records/issues/5
That is a good strategy, if users need it you can always build on top of it. In scala-records we will use the structural types for this.
@vjovanov for what exactly? Renames? How would the syntax be?
Yep for renames, although they would be rather nested records. If you merge two records the collided fields would be in the nested record:
Rec {
lhs: Rec { collidedField: String }
rhs: Red { collidedField: String }
// .. the rest
}
currently there is
&
which is a union operator on the key value pairs. The default should probably rather be a disjoint union that throws a type error in case of overlap.Overview of useful operators that should be implemented
&
)|
&
r \ (select field1 & field2)
orr(remove field1 & field2)
or