You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ll add the optional label behavior to AbstractObject as described, with the default implementation returning nothing and the appropriate implementation for Lens.
I’ll keep the change minimal and add or update tests to verify the expected label behavior before opening the PR.
Add docs to the AbstractObject supertype so that the contract is clear. Users will need a way to pass or mutate labels during or after object creation, so you need to consider that
Instead of a label field in every AbstractObject (as #94 suggests and PR #95 started), labels and metadata live in the system: System and StaticSystem get a meta::IdDict{Any, Dict{Symbol, Any}} field. Then naming works for every object, including user-defined components, with no change to any component struct or constructor (in line with the extension promise). Labels can be renamed after creation even though the components are immutable structs. And a name is unique where it means something, within one setup. The API: System(["M1" => m1, "BS" => bs, l1]), push!(system, "L2" => l2), label(system, obj), label!(system, obj, "L1") (errors on duplicates), system["BS"], and meta(system, obj) for arbitrary metadata, with the label stored under :name. meta is the only per-system-type method; everything else is built on it. The one drawback is that a standalone object outside a system has no label.
Rollout: (1) Update #94 with this design and explain why the per-object field was dropped. (2) BMO PR with the verbs, tests (pairs, push!, renaming, duplicate labels, objects not in the system, ObjectGroups, StaticSystem, deepcopy, SubString labels), docstrings and the agent skill update. (3) GUI PR: _label reads label(system, obj), renaming in the GUI calls label!, the labels keyword of live_view is deprecated in favor of this, and code export writes the pair syntax.
Thanks for the detailed proposal. The system-level metadata approach makes sense, especially since it supports labels for user-defined components without requiring changes to their structs or constructors, and allows labels to be renamed even for immutable objects.
I'll update #94 to reflect this design and the reasoning for moving labels out of individual objects.
For the implementation, I'll follow the proposed rollout:
add meta::IdDict{Any, Dict{Symbol, Any}} to System and StaticSystem
build the label API around meta(system, obj)
support labeled construction via pairs, push!, renaming, duplicate-label checks, and lookup
cover objects outside the system, ObjectGroups, StaticSystem, deepcopy, and SubString labels
add the corresponding docstrings and agent skill updates
handle the GUI changes separately as proposed
For #95, I'll rework the current per-object implementation to follow this design rather than continuing with the Lens field approach.
Activity
sameer-dhande commentedon Sep 29, 2026
Hi @StackEnjoyer , I’d like to work on this issue.
I’ll add the optional
labelbehavior toAbstractObjectas described, with the default implementation returningnothingand the appropriate implementation forLens.I’ll keep the change minimal and add or update tests to verify the expected label behavior before opening the PR.
StackEnjoyer commentedon Sep 29, 2026
Go for it 👍
Actually, you can introduce a label field for all currently introduced
AbstractObjects. The generic behaviour would then be:label(o::AbstractObject)::Union{Nothing, String} = o.labelAdd docs to the
AbstractObjectsupertype so that the contract is clear. Users will need a way to pass or mutate labels during or after object creation, so you need to consider thatTacHawkes commentedon Sep 30, 2026
Proposal after reviewing #95 :
Store labels in the system, not in the objects.
Instead of a
labelfield in everyAbstractObject(as #94 suggests and PR #95 started), labels and metadata live in the system:SystemandStaticSystemget ameta::IdDict{Any, Dict{Symbol, Any}}field. Then naming works for every object, including user-defined components, with no change to any component struct or constructor (in line with the extension promise). Labels can be renamed after creation even though the components are immutable structs. And a name is unique where it means something, within one setup. The API:System(["M1" => m1, "BS" => bs, l1]),push!(system, "L2" => l2),label(system, obj),label!(system, obj, "L1")(errors on duplicates),system["BS"], andmeta(system, obj)for arbitrary metadata, with the label stored under:name.metais the only per-system-type method; everything else is built on it. The one drawback is that a standalone object outside a system has no label.Rollout: (1) Update #94 with this design and explain why the per-object field was dropped. (2) BMO PR with the verbs, tests (pairs,
push!, renaming, duplicate labels, objects not in the system,ObjectGroups,StaticSystem,deepcopy,SubStringlabels), docstrings and the agent skill update. (3) GUI PR:_labelreadslabel(system, obj), renaming in the GUI callslabel!, thelabelskeyword oflive_viewis deprecated in favor of this, and code export writes the pair syntax.sameer-dhande commentedon Sep 30, 2026
Thanks for the detailed proposal. The system-level metadata approach makes sense, especially since it supports labels for user-defined components without requiring changes to their structs or constructors, and allows labels to be renamed even for immutable objects.
I'll update #94 to reflect this design and the reasoning for moving labels out of individual objects.
For the implementation, I'll follow the proposed rollout:
meta::IdDict{Any, Dict{Symbol, Any}}toSystemandStaticSystemmeta(system, obj)push!, renaming, duplicate-label checks, and lookupObjectGroups,StaticSystem,deepcopy, andSubStringlabelsFor #95, I'll rework the current per-object implementation to follow this design rather than continuing with the
Lensfield approach.sameer-dhande commentedon Sep 30, 2026
Revised implementation approach
Following the discussion, this issue will be implemented using system-level metadata rather than storing labels directly on
AbstractObjects.Design
SystemandStaticSystemstore system-local metadata: