Skip to content

Rewrite nested get/setindex handling - #12

Merged
aviks merged 7 commits into
JuliaComputing:masterfrom
joshday:jd/dev
Oct 19, 2026
Merged

aviks merged 7 commits into
JuliaComputing:masterfrom
joshday:jd/dev

Conversation

@joshday

@joshday joshday commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

The old EasyConfig would leave dangling Configs around when getindex-ing keys that didn't exist, and then delete them explicitly with EasyConfig.delete_empty! or implicitly when calling Base.isempty (which is called during Base.show).

Since I originally wrote the package I've been meaning to do something better, and now I have:

julia> c = Config()
Config()

julia> c.one.two.three
Undefined(one → two → three)

julia> c
Config()

julia> c.one.two.three = "value"
"value"

julia> c
Config{Dict{Symbol, Any}} with 1 entry:
  :one => Config(:two => Config(:three => "value"))

Explanation in the README:

  • Accessing a non-existent property creates an Undefined.
  • This is necessary for assigning deeply nested properties (an eventual setindex! after nested getindex-es).
    • config.a == Undefined(config, [:a]), config.a.b == Undefined(config, [:a, :b]), etc.
  • config.a.b.c = 1 == Undefined(config, [:a, :b])[:c] = 1

Other new features:

  • Config can now wrap any AbstractDict{Symbol,Any}, uses Dict{Symbol,Any} by default
  • deepmerge/deepmerge! for merging nested configs
  • Switch from CompatHelper to Dependabot. Dependabot auto-merge workflow added (requires enabling auto-merge in the repo)

@joshday

joshday commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@aviks could I recruit you to both (1) merge this PR, and (2) transfer this to JuliaPlots (PlotlyLight is the primary dependent), my user account, or some other Julia org?

@aviks
aviks merged commit f8154fd into JuliaComputing:master Oct 19, 2026
8 checks passed
@aviks

aviks commented Oct 19, 2026

Copy link
Copy Markdown
Member

Do you want to make a release from here before moving?

@joshday

joshday commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@aviks that would be great if you don't mind!

@joshday
joshday deleted the jd/dev branch October 20, 2026 15:33
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.

2 participants