Repository navigation
feat: ._ shorthand to include all child aspects - #536
Merged
Merged
Conversation
den.aspects.foo._ now acts as a synthetic aspect that auto-includes all immediate child aspect keys of foo. Hides synthetic keys behind __functor so existing lib.attrValues patterns on _ are unaffected. wrapFunctorChild detects zero-arg functors returning aspect-shaped values and resolves them immediately. Child key filtering excludes structural, class, pipe, forwarded, and __-prefixed keys.
Without this, excludes could leak into childKeys for synthetic provides and into classification as a freeform key.
Locks invariant that synthetic name/includes are hidden from attrNames, and that ._ only includes immediate children.
Collaborator
|
This is an EXCELLENT idea! |
charlesfire
pushed a commit
to charlesfire/den
that referenced
this pull request
May 16, 2026
## Summary - `den.aspects.foo._` now acts as a synthetic aspect that auto-includes all immediate child aspect keys of `foo` - Enables `includes = [ den.aspects.foo._ ]` instead of enumerating each child explicitly - Synthetic keys hidden behind `__functor` so existing `lib.attrValues` patterns on `_` are unaffected - Adds `excludes` to `structuralKeysSet` (pre-existing gap now surfaced) ## Implementation **`types.nix`**: Both `mergeWithAspectMeta` and `mergeFunctions` compute child aspect keys (filtering out structural, class, pipe, forwarded, and `__`-prefixed keys) and build a synthetic aspect delivered via `__functor` on provides/_. **`normalize.nix`**: `wrapFunctorChild` detects zero-arg functors returning aspect-shaped values and resolves them immediately. **`key-classification.nix`**: Added `excludes` to `structuralKeysSet`. ## Test plan - [x] 7 new tests in `include-children` suite (basic, empty, mixed, provides-coexistence, parametric, attrValues compat, no-grandchildren) - [x] 801/801 full CI passes
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.
Summary
den.aspects.foo._now acts as a synthetic aspect that auto-includes all immediate child aspect keys offooincludes = [ den.aspects.foo._ ]instead of enumerating each child explicitly__functorso existinglib.attrValuespatterns on_are unaffectedexcludestostructuralKeysSet(pre-existing gap now surfaced)Implementation
types.nix: BothmergeWithAspectMetaandmergeFunctionscompute child aspect keys (filtering out structural, class, pipe, forwarded, and__-prefixed keys) and build a synthetic aspect delivered via__functoron provides/_.normalize.nix:wrapFunctorChilddetects zero-arg functors returning aspect-shaped values and resolves them immediately.key-classification.nix: AddedexcludestostructuralKeysSet.Test plan
include-childrensuite (basic, empty, mixed, provides-coexistence, parametric, attrValues compat, no-grandchildren)