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 method copyOptionFromIfPresent 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 method inheritFrom(Configuration) to ConfigurationBuilder. The difference between inheritFrom and copyFrom would be that the former affects only options with inheritable=true. Of course inheritance would be transitive. Probably we do not need to allow multi-inheritance.
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 methodcopyOptionFromIfPresentthat 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
inheritableto@Optionand a methodinheritFrom(Configuration)toConfigurationBuilder. The difference betweeninheritFromandcopyFromwould be that the former affects only options withinheritable=true. Of course inheritance would be transitive. Probably we do not need to allow multi-inheritance.