Remove the re-exports of CTModels and ExaModels once @def is hygienic

Aperta
#967 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@ocots ci sta già lavorando.

Dal 9/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Summary

Once the generated code of @def contains the modules instead of their names (https://github.com/control-toolbox/CTParser.jl/issues/356), OptimalControl no longer needs to re-export the module names CTModels and ExaModels. Remove these re-exports, so that using OptimalControl does not bring implementation packages into the namespace of the user. The same for CTLie: see #966, which concerns @Lie (control-toolbox/CTLie.jl#40).

Why they are re-exported today

Each of these lines is commented # for generated code (prefix):

File Line Used by
src/imports/ctmodels.jl @reexport import CTModels: CTModels @def, backend :fun
src/imports/examodels.jl @reexport import ExaModels: ExaModels @def, backend :exa
src/imports/ctbase.jl @reexport import CTBase: CTBase @def (errors), @Lie (CTBase.Traits)
src/imports/ctlie.jl @reexport import CTLie: CTLie @Lie (see #966)
src/imports/ctflows.jl @reexport import CTFlows: CTFlows to check: no generated code is known to name CTFlows

Today, import OptimalControl followed by OptimalControl.@def … fails with UndefVarError: CTModels not defined, because the generated code names the module in the caller's module.

To do, after the CTParser issue is released

  1. Bump the compat of CTParser (and of CTLie, for #966).
  2. Remove the re-exports of the table that are no longer needed, and the comments that justify them. Keep a re-export only if it is useful by itself: CTBase is used by users for CTBase.Differentiation and the exceptions in the documentation; decide whether it stays exported.
  3. Update test/suite/reexport/, which checks the exported names, and add a test of @def after import OptimalControl only, and after using OptimalControl: @def.
  4. Update the documentation: the page "The @Lie macro" (section "using OptimalControl is needed"), and check the pages that use CTBase.…, CTModels.… or ExaModels.… after using OptimalControl.
  5. Mention the removed names in BREAKING.md and the changelog of the release.
Lingua principale
Julia
Stelle
135
Fork
11
Merge medio
7h 49m
PR unite (30g)
23

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di control-toolbox/OptimalControl.jl

Tutte le issue di control-toolbox/OptimalControl.jl

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.