Skip to content

feat(lang): Tier C — children(), echo(), assert(), recursive functions#18

Merged
particlesector merged 1 commit into
mainfrom
base16/20260508-224435-v2-5-tier-c
May 9, 2026
Merged

feat(lang): Tier C — children(), echo(), assert(), recursive functions#18
particlesector merged 1 commit into
mainfrom
base16/20260508-224435-v2-5-tier-c

Conversation

@particlesector
Copy link
Copy Markdown
Owner

Implements the four Tier C language completeness items:

  • children() / $children: modules can now receive and render the child geometry passed at the call site. children() yields all children, children(i) yields the i-th. $children holds the count. A stack-based context correctly handles nested children() across module layers.

  • echo(): captures all arguments into CsgScene.echoMessages; MeshBuilder forwards them to the diagnostics panel as Info-level entries (cyan).

  • assert(cond[, msg]): records an Error diagnostic in CsgScene.evalDiags when the condition is falsy; MeshBuilder merges these into BuildResult.

  • Recursive functions: already functional from Tier A; confirmed with a new CsgEvaluator test driving geometry from fib().

Supporting changes:

  • parsePrimary now handles SpecialVar tokens as VarRef so $children, $fn, $fs, $fa are readable in expression context.
  • $fn/$fs/$fa are seeded into the interpreter env at evaluate() entry.
  • DiagnosticsPanel renders Info level in cyan to distinguish echo output from warnings (yellow) and errors (red).
  • 22 new unit tests in test_csg_evaluator.cpp + tier_c_test.scad.

Implements the four Tier C language completeness items:

- children() / $children: modules can now receive and render the child
  geometry passed at the call site. children() yields all children,
  children(i) yields the i-th. $children holds the count. A stack-based
  context correctly handles nested children() across module layers.

- echo(): captures all arguments into CsgScene.echoMessages; MeshBuilder
  forwards them to the diagnostics panel as Info-level entries (cyan).

- assert(cond[, msg]): records an Error diagnostic in CsgScene.evalDiags
  when the condition is falsy; MeshBuilder merges these into BuildResult.

- Recursive functions: already functional from Tier A; confirmed with a
  new CsgEvaluator test driving geometry from fib().

Supporting changes:
  - parsePrimary now handles SpecialVar tokens as VarRef so $children,
    $fn, $fs, $fa are readable in expression context.
  - $fn/$fs/$fa are seeded into the interpreter env at evaluate() entry.
  - DiagnosticsPanel renders Info level in cyan to distinguish echo output
    from warnings (yellow) and errors (red).
  - 22 new unit tests in test_csg_evaluator.cpp + tier_c_test.scad.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@particlesector particlesector merged commit 247ef20 into main May 9, 2026
4 checks passed
@particlesector particlesector deleted the base16/20260508-224435-v2-5-tier-c branch May 9, 2026 07:06
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