Skip to content

Public interface for manually constructing Records? #79

@nickrobinson251

Description

@nickrobinson251

When first developing this package, I assumed users would always use parse_network to create a Network and associated Records. The Records are public API, and users are expected to access their fields (also public API).

But I never thought users would want to manually construct Records, passing in their own data like Buses30([1, 2], ["A", "B"], ...) etc.

The problem is that as we learn more about this wacky data format we get new requests, like #27, some of which are best solved by adding new fields to the Records types. And if the constructors for Records types are public API then adding new fields is breaking... and to make it non-breaking we have to add long methods like Buses30(arg1, arg2, ..., argN) = Buses30(arg1, arg2, ..., argN, new_field_default_value) which is burdensome for maintainence.

We've slowly been adding more user-friendly constructors, like #73, so we might want to decide and document what constructors are public API e.g. defining all keyword constructors and say these are the only public constructors. To do that we'd need to remove the existing no-arg constructor e.g. replace

@eval $R(sizehint::Integer=0) = $R(map(T -> sizehint!(T(), sizehint), fieldtypes($R))...)::$R

with $R(sizehint::Integer)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaneeds some investigation before we decide

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions