Skip to content

[inconsistency] merge on Attributes does not work in the same way as the one in the standard library  #1939

@kunzaatko

Description

@kunzaatko
julia> at1 = Attributes(;c = 1)
> Attributes with 1 entry:
  c => 1

julia> at2 = Attributes(;c = 2)
> Attributes with 1 entry:
  c => 2

julia> merge(at1, at2)
> Attributes with 1 entry:
  c => 1

Where in the standard library as it states in the docs:

Construct a merged collection from the given collections. If necessary, the types of the resulting collection will be promoted to
accommodate the types of the merged collections. If the same key is present in another collection, the value for that key will be the
value it has in the last collection listed. See also mergewith for custom handling of values with the same key.

And it works as stated.

julia> d1 = Dict(:a => 1)
> Dict{Symbol, Int64} with 1 entry:
  :a => 1

julia> d2 = Dict(:a => 2)
> Dict{Symbol, Int64} with 1 entry:
  :a => 2

julia> merge(d1, d2)
> Dict{Symbol, Int64} with 1 entry:
  :a => 2

Wouldn't it be easier just to use the merge on the underlining Dict and keep it consistent with the expectation of people that are familiar with the merge function? If it is used somewhere deeper in the pipeline, it should not be an expansion of the merge method and be called something else... (You can assign me)

Metadata

Metadata

Assignees

No one assigned

    Labels

    MakieBackend independent issues (Makie core)breakinga PR with breaking changesbug

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions