Skip to content

Add support for Base.ImmutableDict #216

Description

@danielmatz

I tried to use Accessors with Base.ImmutableDict:

julia> x = Base.ImmutableDict("a" => 1, "b" => 2)
Base.ImmutableDict{String, Int64} with 2 entries:
  "b" => 2
  "a" => 1

julia> @set x["b"] = 3
ERROR: MethodError: no method matching empty!(::Base.ImmutableDict{String, Int64})
The function `empty!` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  empty!(::ComputePipeline.ComputeGraph)
   @ ComputePipeline ~/.julia/packages/ComputePipeline/03tW7/src/ComputePipeline.jl:1041
  empty!(::Scene; reset_theme)
   @ Makie ~/.julia/packages/Makie/4JW9B/src/scenes.jl:471
  empty!(::Compiler.CompilationQueue)
   @ Base ~/.julia/juliaup/julia-1.12.0+0.aarch64.apple.darwin14/share/julia/Compiler/src/typeinfer.jl:1333
  ...

Stacktrace:
 [1] copy!(dst::Base.ImmutableDict{String, Int64}, src::Base.ImmutableDict{String, Int64})
   @ Base ./abstractdict.jl:200
 [2] setindex
   @ ~/.julia/packages/Accessors/8Y4uq/src/setindex.jl:22 [inlined]
 [3] set(obj::Base.ImmutableDict{String, Int64}, lens::IndexLens{Tuple{String}}, val::Int64)
   @ Accessors ~/.julia/packages/Accessors/8Y4uq/src/optics.jl:417
 [4] top-level scope
   @ REPL[62]:1

It would be nice to add support for Base.ImmutableDict.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions