Skip to content

Conversation

@zbynekwinkler
Copy link
Member

@jisa Does this help?

@zbynekwinkler zbynekwinkler requested review from jisa and m3d September 7, 2020 09:47
@@ -53,8 +54,14 @@ def config_load(*filenames, application=None):


def merge_dict(dict1, dict2):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming is somewhat confusing. It took me some time to realize that dict1 and dict2 and not necessarily dictionaries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to refactor the code, maybe it is better now.

if isinstance(dict1, t) and isinstance(dict2, t):
return dict2

if not isinstance(dict1, dict) or not isinstance(dict2, dict):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One type that I do not see supported and we have in the config is lists. Unfortunately, I do not see a generic solution. For a list that represents, for example, image size, it is better when the second config overrides the first one. For a list of links between nodes, appending the second list to the first one would be more convenient.

Any opinions about what we should do with lists?

I have a weak preference for "override" and for figuring out what to do with links separately.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some length of time I have my doubts about the whole config file approach. Maybe we should not have config files but python modules/functions that build the required config and then exec into the graph. I have been on and off wrestling with configurability for example in #525 without getting anywhere. Maybe run_solution.bash should be run_solution.py so that the configuration can be built in an actual programming language?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, every configuration eventually becomes Turing complete. But let's not do that yet.

What should we do about the lists for now. Override?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the override for list and tuple.

If every configuration eventually becomes Turing complete, it is better when that is done through an actually usable language rather than some ad hoc solution (just look at CMake "language").

if isinstance(dict1, t) and isinstance(dict2, t):
return dict2

if not isinstance(dict1, dict) or not isinstance(dict2, dict):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, every configuration eventually becomes Turing complete. But let's not do that yet.

What should we do about the lists for now. Override?

@zbynekwinkler
Copy link
Member Author

@m3d ?

@zbynekwinkler zbynekwinkler merged commit 4e81f1b into master Sep 10, 2020
@zbynekwinkler zbynekwinkler deleted the feature/merge-dict branch September 10, 2020 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants