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

Alternative syntax for accessing and changing MizerParams slots #213

Closed
gustavdelius opened this issue Aug 20, 2021 · 1 comment
Closed
Labels
enhancement New feature requests or suggestions for enhancement of existing features setting parameters Issue relates to the part of mizer used for setting up MizerParams objects.

Comments

@gustavdelius
Copy link
Member

gustavdelius commented Aug 20, 2021

Currently, to change for example the intake_max slot in a MizerParams object called params to a new value called my_intake_max one would do

params <- setMaxIntakeRate(params, intake_max = my_intake_max)

This kind of notation is convenient if one uses the pipe operator, but clunky otherwise. Sometimes it would be nice to simply do

intake_max(params) <- my_intake_max

This is as brief as the old

params@intake_max <- my_intake_max

but would provide the advantage of automatic validation of the new value and of protecting the value from accidental overwriting, as discussed in https://blog.mizer.sizespectrum.org/posts/2021-08-08-change-model-parameters-without-using/

It is also in line with how we change species_params, gear_params and resource_params.

@gustavdelius gustavdelius added enhancement New feature requests or suggestions for enhancement of existing features setting parameters Issue relates to the part of mizer used for setting up MizerParams objects. labels Aug 20, 2021
@gustavdelius
Copy link
Member Author

Closed by commit fe92d8c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature requests or suggestions for enhancement of existing features setting parameters Issue relates to the part of mizer used for setting up MizerParams objects.
Projects
None yet
Development

No branches or pull requests

1 participant