Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

RFC: Allow recursive merging of Attributes #32

Merged
merged 2 commits into from
Nov 3, 2018
Merged

Conversation

mkborregaard
Copy link
Member

@mkborregaard mkborregaard commented Oct 30, 2018

Allows:

a = Theme(color = :red, axis = Theme(frames = ((true, false), (true, false))));
b = Theme(color = :blue, foo = false, axis = Theme(frames = ((false, false), (false, false))));
c = Theme(foo = true, scatter = Theme(color = :red));
merge(a,b,c).attributes
# Dict{Symbol,Observables.Observable} with 4 entries:
#   :color   => Observable{Any}("ob_05", :blue, Any[])
#   :scatter => Observable{Any}("ob_13", Attributes(Dict{Symbol,Observables.Observable}(:color=>Observable{Any}("ob_08", :red, Any[]))), Any[])
#   :axis    => Observable{Any}("ob_03", Attributes(Dict{Symbol,Observables.Observable}(:frames=>Observable{Any}("ob_04", ((false, false), (false, false)), Any…
#   :foo     => Observable{Any}("ob_09", true, Any[])

@@ -275,6 +275,25 @@ function merge_attributes!(input, theme, rest = Attributes(), merged = Attribute
return merged, rest
end

function merge_attributes_doublebang!(input, theme)
Copy link
Member Author

Choose a reason for hiding this comment

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

the name is a joke of course and should be changed before merging

@mkborregaard
Copy link
Member Author

You're happy with the function name? :-D

@mkborregaard mkborregaard deleted the mkb/merge branch November 4, 2018 09:49
@SimonDanisch
Copy link
Member

Can still be changed, and I wanted to progress ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants