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

オープン
#967 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@ocots がすでに取り組んでいます。

2026年10月9日 から。

評価

この issue はまだ評価されていません。

説明

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.
主要言語
Julia
スター
135
フォーク
11
平均マージ
7時間 49分
マージ済み PR(30日)
23

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

control-toolbox/OptimalControl.jl のほかの issue

control-toolbox/OptimalControl.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。