Repository navigation
Ariadne: repeat: {children: key}, an instance per child of a state key, named by it - #1585
Merged
Merged
Conversation
…y, named by it
A repeat over a key's children draws its template once per child, in name order, with {key}
the child's name wherever {i} is filled in today ({i} is its place). An instance is its child:
its backend id and a repeated mount's sub-prefix go by the name, so it keeps its state, its
init: and its on_tick: resident as siblings are added and taken out. A load: with
as: "{key}" mounts each child at includes.<name>, its link: targets, name: and handlers
filled in per child.
- loader: repeat: {children: key} on any widget (Widget::repeat_children); as: keeps its {i}
and {key} tokens, and warns when no repeat: fills them in.
- runtime: an instance is keyed by a string (instance_path, mount_instances_, mount ticks);
a mount instance whose child is gone has its resident stopped and its instance freed;
the Windows menu and the per-frame applications expand keyed repeats too.
- schema: widget_repeat takes the map form (ari validate).
- docs/ARIADNE.md 6.3, 6.5, 5.25, 7.3, 7.4; examples/ariadne/documents/sites.ari.
- tests: runtime, loader and an FTXUI snapshot test.
This was referenced Nov 27, 2026
…dren # Conflicts: # docs/ARIADNE.md # src/cvc/ariadne/loader.cpp
transfix
enabled auto-merge (squash)
November 28, 2026 09:19
Conflicts:
- docs/ARIADNE.md 6.3: the repeat section, then master's contributes:, shares:, grants: and
application sections, then the closing paragraph on repeat versus mounts:.
- ariadne.cpp substitute_index_one: master's menu icons (SH10) and table rows/headers go
through sub(), so they take {key} as well as {i}. The table copy is `tbl`, since `t` is the
instance's tokens.
- The walk frame: master's comment on inst, plus the PR's keys.
Master's table rows (TableRows) now use the PR's string instance keys: the row index is
both {i} and {key}, as for a counted repeat. instance_path takes the string and autofocus
takes a pointer to it.
transfix
added a commit
that referenced
this pull request
Nov 30, 2026
A widget's repeat: takes {children: KEY}: an instance per child of the key, in name order, under
the child's name, {key} beside {i}. A repeated mount's scope goes by the child; {i} and {key} in
as: are kept for its instances, and warn and are taken literally without the repeat that fills
them in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
repeat: {children: KEY}draws a template once per child of a state key, in name order, worked out each frame.{key}is the child's name, filled in wherever{i}is today ({i}is its place this frame). An instance is its child, not a position, so adding or removing a site leaves the other sites' instances as they were.This is what nicotina needs to drop its numbered
slots.<i>(cy-pca/nicotina#46, docs/COMPONENTS.md 3.6, CD-10): one module per site, atincludes.<site>, named by the site:Don't merge without Joe's OK.
What changes
loader.cpp):repeat:takes a map{children: KEY}on any widget, aload:included (Widget::repeat_children;repeatholds the key).as:keeps{key}and{i}as written for each instance to fill in. With norepeat:to fill them in, it warns and takes them literally (_key_).{key}as it skips{i}.ariadne.cpp): an instance's identity is a string key: the child's name, or the index under a count.{key}is filled in through every field{i}already reaches:id,label,bind,on, the pointer handlers, the predicates,link:names and targets,name:and the rest of the §6.5 list. It also fills inapp_name, foras: "{key}".as:with its tokens filled in, elseas:with the key appended (includes.<as>.<name>, as a count'sincludes.<as>.<i>). In the sub-prefix, a name's characters other than letters, digits,_and-become_.instance_path,mount_instances_and the mount ticks are keyed by that string, andpush_idtakes the key. A child's backend id, sub-prefix, holes,init:andon_tick:resident therefore stay with it as siblings are added or removed.sweep_repeated_ticks, which now also prunesmount_instances_; count repeats get the same pruning). Its state stays under its sub-prefix, as a quit application's does.plan_frame_apps) expand keyed repeats. A keyed mount with noname:is named by its child:tx_wtfforas: "{key}"with nometa.name, elseSite tx_wtf.widget_repeatdef (a count, or{children: string}, closed) for widgets. Scene nodes keep the count-onlyrepeat.ari validatefollows.{key}(§6.5), a module per child of a key (§6.3), applications (§5.25), the sub-prefix (§7.3), when a resident stops (§7.4).examples/ariadne/documents/sites.arimountsapps/site.ariper site, with Add and Remove.Why this approach
Op::Instancesframe andbegin_repeat, not the old recursiveemit_node.mounts:, open): a trialgit merge-treeof this branch with its head 124a59c merges all code without conflicts. The one conflict is a paragraph in ARIADNE.md §6.3, where both branches add text at the same place. The merged tree was not built.link:per entry onmounts::mounts:loads a URI that each entry names in state. Each mount is sandboxed by its principal and budget, and nolink:holes are granted by design.load:fits that case.repeat: {children:}also works on plain widgets (a row per site) and grid cells.Tests
New tests:
AriadneReactive.ARepeatOverAKeysChildrenNamesEachInstanceByItsChild: name order,{i}/{key}, backend ids by name; a child added first and one taken out; a missing key draws nothing.AriadneReactive.ARepeatOverAKeysChildrenFillsAGridsCells: a cell per visible child.AriadneMountScope.AMountRepeatedOverAKeysChildrenKeepsEachChildsInstance(a loaded fragment withinit:andon_tick:): sites a and c, then b added and a taken out.init:doesn't run again, and itson_tick:resident keeps the same pid.init:runs; a's resident is stopped and its state kept.sessions.c.AriadneRuntime.AMountRepeatedOverAKeysChildrenIsAnApplicationPerChild: menus named by child, byname:with{key}, andincludes.<as>.<key>; Quit by name.AriadneRuntime.WindowsMenuListsAWindowRepeatedOverAKeysChildren.AriadneMount.ARepeatOverAKeysChildrenKeepsItsTokensForEachChildandAriadneMount.ARepeatOverChildrenThatIsMalformedWarns(loader and schema).AriadneFtxui.AMountRepeatedOverAKeysChildrenDrawsARowPerChild: the FTXUI snapshot (whatari snapshotprints) of a keyedload:in one window. It checks the rows in name order, then that after a site is added first and one is removed, tx_wtf shows the note itsinit:wrote once and its visits through its hole.Verified (Ubuntu 24.04, GCC, Release, FTXUI and tvision, cvcGL off)
ctest -R ^ari_ari validatepassessites.ariandapps/site.ari.ari snapshotdrawssites.ariwith a window per site (the terminal cascades them).Not run here: cvcGL's ImGui backend and goldens, macOS, Windows, wasm (CI). Frame time wasn't measured. A count repeat now makes a string key per instance (it already made the string for
push_id), andinstance_pathholds strings.