Ampersand
Ampersand copied to clipboard
Error in the code generator for singletons
What happened
I ran the following Ampersand script for the purpose of demonstrating that the rule UniverseExists
guarantees that the atom _UNIVERSE
of type Module
always exists.
CONTEXT Issue1475
RELATION id[Module*Id] [UNI,TOT]
INTERFACE Modules FOR User: "_SESSION";V[SESSION*Module] BOX [ id : id ]
RULE UniverseExists : "_UNIVERSE" |- I[Module]
POPULATION id CONTAINS [ ("_UNIVERSE", "_UNIVERSE") ]
ENDCONTEXT
I executed the prototype. To my surprise, I found that I can delete module _UNIVERSE
in the most straightforward way:
https://github.com/AmpersandTarski/Ampersand/assets/275768/2e57e2b8-0529-4563-8ee7-443adb285019
What I expected
I expected that the prototype would not let me delete module _Universe
. Just to verify, I compiled the script without the population statement. As expected I got a compiler message that noticed the missing module:
.246 /usr/local/project/Issue1475.adl:4:1 error:
0.246 There is one violation of RULE "UniverseExists":
0.247 ("_UNIVERSE", "_UNIVERSE")
0.247 2024-03-29 07:01:05.852413: [error] ExitFailure 10
This confirms my expectation that the back end should not allow me to delete module _UNIVERSE
.
Version of ampersand that was used
I ran the prototype on ampersandtarski/prototype-framework:v1.14, which runs Ampersand-v4.6.2 [51c3de2e65c540ef026925fe8547c991765a5588:refs/tags/v4.6.2] with the following settings: --[no-]backend True --[no-]frontend True --[no-]metamodel False --[no-]terminal False --[no-]time-in-log True --[no-]trim-cellvalues True --build-recipe Prototype --crud-defaults CRUD --frontend-version AngularJS --ignore-invariant-violations False --interfaces False --language Nothing --namespace "" --output-dir "." --proto-dir "/var/www" --sql-bin-tables False --terminal-width Nothing --verbosity debug