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

Should delete! on a component delete stray parameters? #752

Closed
davidanthoff opened this issue Sep 1, 2020 · 1 comment
Closed

Should delete! on a component delete stray parameters? #752

davidanthoff opened this issue Sep 1, 2020 · 1 comment
Milestone

Comments

@davidanthoff
Copy link
Collaborator

I've run into the following scenario: someone gets a model via the m = ModelName.get_model() function. I then remove a component from m via the delete! function. At this point m now can have a number of external parameters that are not used anywhere. Say one of the left-over parameters if called foo. foo was used by the component that I just deleted.

Now I add a new component that also has a parameter foo. Of course when I call set_param!(m, :compName, :foo, 3) it now errors because m already has a parameter called foo.

I'm not sure what the right behavior here would be, and maybe the current one is actually correct....

But here are some alternative options:

  1. delete! on a component could delete stray parameters like foo. That seems a bit drastic, though... Maybe we need a keyword argument also_delete_stray_params that one can use if one wants to get rid of stray parameters?
  2. or is this really a scenario where the replace component functionality should be used?
  3. do we have a function that deletes an external parameter from a model?

Also CCing @FrankErrickson, what he thinks might be useful here.

@lrennels lrennels added this to the Triage milestone Sep 9, 2020
@davidanthoff
Copy link
Collaborator Author

@ckingdon95 and I decided to go with option 1. Just need a good name for the keyword argument. delete_unused_model_params was one idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants