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

Public interface for manually constructing Records? #79

Open
nickrobinson251 opened this issue Jul 19, 2022 · 0 comments
Open

Public interface for manually constructing Records? #79

nickrobinson251 opened this issue Jul 19, 2022 · 0 comments
Labels
idea needs some investigation before we decide

Comments

@nickrobinson251
Copy link
Owner

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)

@nickrobinson251 nickrobinson251 added the idea needs some investigation before we decide label Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea needs some investigation before we decide
Projects
None yet
Development

No branches or pull requests

1 participant