-
Notifications
You must be signed in to change notification settings - Fork 12
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
Inheritable Options #26
Comments
Wouldn't it be better to let the user decide which options shall be inherited inside the configuration file?
We could do something similar like this:
What is the advantage of inheritable options over splitting the original configuration into two files, one which contains what we want to inherit and the other which contains the rest? |
Probably it's hard for the user to know in which scenarios exactly the application will use
I am not sure which scenario you describe. If users want to mark options as inheritable like in your proposal, they could move them to a different file instead and include that file everywhere, yes (so inheritance would not be important). But in my proposal, where application developers define which options are inheritable, how would a solution based on separate files look like? |
I guess I have not yet understood the use case that your proposal is trying to solve. From a user perspective, it would be very confusing if I have to track which options are declared as
The user would also need to know this in case of your proposal, right? Back to what you stated at the end:
Let's think of an example. So your proposal would enable us to have a configuration, let's call it
The project using this configuration then can spawn a subprogram with a configuration that has all properties from Of course one partitioning into inherited and not inherited files might not be enough. When I look at code in For example in
So for In
There are several other examples of this pattern, which could be solved better by your proposal, provided that all the partitions of the individual examples can be fused into two partitions of inherited and not inherited properties. One could get rid of the Here I actually looked at cases where we want all options except a few one, but you mentioned in your proposal that there are cases where we want "but only a select few options. " . |
Maybe the misunderstanding is that this feature proposal is not at all intended for cases where currently Combining
Well, I would hope that the application developers would know for which options it makes sense that they should influence the sub config if specified in the main config. In CPAchecker's case, for example, these would be all those options that specify the semantics of the input task (e.g., |
Yepp, thats it!
I see how it makes sense in this case. Though it would not be apparent that the boolean |
Sometimes we want to create a new configuration based on an existing instance, but we do not want to copy all options from the existing one (this can be done with
copyFrom
), but only a select few options. There exists the methodcopyOptionFromIfPresent
that can be used for this, but this has the disadvantage that the central code that creates the sub config needs to know all options that it should copy by name. Usually configuration options are declared in a decentralized manner.We could solve this by adding a boolean
inheritable
to@Option
and a methodinheritFrom(Configuration)
toConfigurationBuilder
. The difference betweeninheritFrom
andcopyFrom
would be that the former affects only options withinheritable=true
. Of course inheritance would be transitive. Probably we do not need to allow multi-inheritance.The text was updated successfully, but these errors were encountered: