Maketrue/makefalse behave unintuitively
When a structure is passed from one procedure to another, and modified in the other, the original non changed interpreted symbols get lost, and so leads to an inconsistent structure.
Is there a way do this properly? (see attached example)
Comments (9)
-
-
reporter vocabulary voc{ type Klant type Bedrag isa int Aankoop(Klant, Bedrag) Tabel(Bedrag) } structure sample_struc:voc{ Bedrag = {1..5} Tabel = {1;2;3;4;5} } theory theo:voc{} include <mx> procedure main(){ local modifiedStruc = modifyStruc(sample_struc) print(modifiedStruc) printmodels(modelexpand(theo, modifiedStruc)) } procedure modifyStruc(struc){ struc[voc::Klant.type] = {"Jan"} print(struc) maketrue(struc[voc::Aankoop], {"Jan", 3}) return struc }
De lijn
maketrue(struc[voc::Aankoop], {"Jan", 3})
Maakt de structuur inconsistent, alleen heb ik geen idee waarom, Bedrag gaat van 1 tot 5 en in type Klant zit Jan..
-
Op dit moment overschrijf je best geen types. Ik zal eens naar de bug kijken.
-
-
assigned issue to
- marked as minor
-
assigned issue to
-
Het probleem is als volgt: Als je een type overschrijft, zijn alle atomen van relaties over dat type default false (want ze lagen ervoor al buiten het domein en blijven false). Daarnaast maakt maketrue (momenteel) een structuur altijd meer precies. Dus als een atoom al false was, wordt het nu inconsistent (ipv de true die je verwacht, wordt aan gewerkt ;) ).
Dus concreet: oplossing is eerst dat atoom unknown te maken en dan true. makeunknown(struc[voc::Aankoop], {"Jan", 3}) maketrue(struc[voc::Aankoop], {"Jan", 3})
-
- changed title to Maketrue/makefalse behave unintuitively
-
Refs
#718: maketrue and makefalse behave according to intuition. Internally, both versions are available.→ <<cset d44a9aed1e43>>
-
Refs
#718: maketrue and makefalse behave according to intuition. Internally, both versions are available.→ <<cset 921598d0cde8>>
-
- changed status to resolved
Merged in fix_maketrue (pull request #242)
Fixes
#718: maketrue and makefalse behave according to intuition. Internally, both versions are available.→ <<cset 8693f50c1d95>>
- Log in to comment
Wat gaat er mis? En wat verwacht je?
Als je de oorspronkelijke structuur wil bijhouden kan je hem clonen...
strucclone= clone(struc)