Skip to content

Composite constructors #198

Open
Open
@willtebbutt

Description

@willtebbutt

We discovered in #183 that it's really convenient to be able to construct Composites using the object that you're wrapping, as opposed to the things that constitute it. For example

a = (x=5.0, y=4.0)
da = (x=3.0, y=2.0)
Composite{typeof(a)}(da) # convenient when you've already got the object
Composite{typeof(a)}(; da...) # less convenient when you've already got the object (current implementation)

This is particularly acute for objects such as Dicts that can contain quite a large number of fields, so splatting them and reconstituting them would involve a non-negligible amount of compute.

Other than the aesthetic appeal, I can't see a good reason to prefer our current interface over the one introduced for Dicts in #183 .

Obviously, changing this would be breaking and a bit annoying, so we want to try and get it right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Structural TangentRelated to the `Tangent` type for structured (composite) valuesdesignRequires some desgin before changes are made

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions