-
Notifications
You must be signed in to change notification settings - Fork 202
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
Unexpected behavior: unconditional initialization with "default_settings.txt" #35
base: master
Are you sure you want to change the base?
Conversation
…" when provided with another settings file Problem description by example: Let "new_settings.txt" define a new scenario with two groups but only sets a default speed for both groups: "Group.speed = 0.5, 1.5". Since there are no explicit settings for "Group1.speed" or "Group2.speed" once would expect both groups to be set to the default speed when calling './one.sh new_settings.txt'. This is not the case: Since "default_settings.txt" defines explicitly "Group2.speed = 2.7, 13.9", this (specialized) setting will be applied to group 2 of "new_settings.txt" because the Properties object is defaulted with "default_settings.txt" if it exists. This is unexpected behavior and should be removed. Note that if "default_settings.txt" is deleted or directly changed, this is not a problem. There are no warning messages whether "default_settings.txt" is used or not.
This indeed trips up many users, but the behavior is by design. The idea behind always loading Personally I'm fine with changing the The problem, however, is that this change will break all existing settings that rely on the |
Well, existing settings will not break, but they will have to be run by including default settings explicitly (this already works):
|
Right, then this seems like a good tradeoff to me. Maybe print a warning for a while that the default settings are not getting loaded anymore. |
Added the warning when |
Fair enough. This has never been a problem for me, but I can see how it's not really the most intuitive design. I think (temporary?) warning about this chage when settings are not found could be in order. |
I'm not exactly sure what you mean by the (additional?) warning. I added a warning that is printed if calling
but not for calls such as
If any file that is to be loaded is missing, |
} | ||
|
||
boolean use_default = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that this variable is never used
What I meant was that if a variable that is required for some module is not defined in the given settings files, it could be useful to add to the thrown SettingsError description message (in Settings.getSetting method) a hint that the behavior has changed (e.g., saying "note that default_settings.txt is no longer automatically used"). |
I missed to include the actual warning message in the patch (my bad). Fixed now. |
@akeranen Is there anything else to be done? |
IMO this behavior is indeed confusing. The key is: if the user know how default_settings.txt work, he can use it (basically renaming or creating a new one - unintentional pun). If dont, it is better do not "force" the use. |
Problem description by example: Let
new_settings.txt
define a new scenario with two groups but only sets a default speed for both groups:Group.speed = 0.5, 1.5
. Since there are no explicit settings forGroup1.speed
orGroup2.speed
once would expect both groups to be set to the default speed when calling./one.sh new_settings.txt
.This is not the case: Since
default_settings.txt
defines explicitlyGroup2.speed = 2.7, 13.9
, this (specialized) setting will be applied to group 2 ofnew_settings.txt
because the Properties object is defaulted withdefault_settings.txt
if it exists.This is unexpected behavior and should be removed. Note that if
default_settings.txt
is deleted or directly changed, this is not a problem. There are no warning messages whetherdefault_settings.txt
is used or not.This patch does not change the default behavior of starting ONE with
default_settings.txt
if called without any arguments.