Repository navigation
Named functors from the constraint inspection accessors - #535
Conversation
SubPathConstraint and SubBoundaryConstraint become out of place and are returned directly, instead of being wrapped in the anonymous closure of CTBase.Core.to_out_of_place, whose display leaked a var"#f#" chain. A single row is an Int index, so the value is a scalar (DIM1). Refs #533. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A group holding a single declaration stored the raw user function, so the type and display of path_constraints_nl / boundary_constraints_nl depended on the number of constraints. Refs #533. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #533. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Constraints page, CompositeConstraint docstring, CHANGELOG and a CHG4 note in BREAKING.md. Refs #533. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase A —
|
Phase B — uniform nonlinear groups (4651141)
Hot path check: CTDirect calls |
Phase C — display regression test (8b0e39d)New |
Phase D — docs (3ec23a7)
|
Closes #533.
Conventions: ct-conventions v0.14.0 · ct-agents v0.5.0
What
Every callable returned by the constraint inspection accessors is now a named functor with a stable
show. Values and call signatures are unchanged.Design choices (departing from the issue's suggestions where noted)
constraint(model, label): rather than a named wrapper aroundCTBase.Core.to_out_of_place(or a CTBase change),SubPathConstraint/SubBoundaryConstraintare made out of place and returned directly. CTModels was the only user ofto_out_of_placeand of these functors in the ecosystem. A single row is stored as anInt, so the scalar/vector shape (DIM1) is encoded in the type, likeBoxProjection. The buffer element type is widened from the arguments, as before (AD).*_constraints_nl: every group is aCompositeConstraint(n = 0, 1, …). The point is less the display than a group type independent of the cardinality. CTDirect already goes through this path as soon as there are two constraints; a performance test checks that a single-declaration group allocates exactly what the wrapped function allocates.dynamics/lagrange/mayer: not wrapped. They return the user's own functions, which is the right contract (identity preserved). Thevar"#fun##…"names come from the__symgen(:fun)of CTParser's@def; that belongs to CTParser (separate issue).Commits (one per phase)
fix: out-of-place named functors fromconstraint(+ docstrings of the functors and ofconstraint)fix: every nonlinear group is aCompositeConstrainttest: regression — no inspection callable prints avar"#"chain, for the five constraint kindsdocs: Constraints page (stacked groups, new "Reading a constraint by label" section), CHANGELOG,CHG4note in BREAKING.mdChecks
julia --project=docs docs/make.jl, second pass for the InterLinks self-inventory).Compatibility
No breaking change: the concrete types returned change, not the calls nor their values. Fits a patch release (0.21.3).
🤖 Generated with Claude Code