AlgebraicJulia / AlgebraicJulia/GATlab.jl

Global constants that get modified during precompilation don't work

Offen
#181 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Julia
Sterne
43
Forks
4
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

The `@theory` macro includes a line to register each theory module, indexed by the data of the theory.

```
const GAT_MODULE_LOOKUP = Dict{ScopeTag, Module}()
```

This is convenient when one is working with GATs rather than the associated theory modules but then need to do something with the theory module, e.g. using a theory morphism to do a model migration.

However, when testing this with Catlab, this no longer seems to work. Catlab adds a new theory, `T`, and during precompilation one can check that `T` is in `GAT_MODULE_LOOKUP`. But if one loads up GATlab and Catlab in the REPL, `T` is no longer in the cache (only the theories added in GATlab are there).

This might be relevant https://discourse.julialang.org/t/mutating-global-variable-during-precompilation/51478/3 \

In the immediate future, one workaround could be to only use `@theorymap` modules (which have the dom and codom modules) for migration.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.