diff options
author | dos-reis <gdr@axiomatics.org> | 2008-12-20 14:49:58 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-12-20 14:49:58 +0000 |
commit | 70962cd1ef47767d4cb623a129b5c955a5aec41e (patch) | |
tree | 707fb471ad0ed35c02fbeec25f8dc64a7fd7df92 | |
parent | b91f52ba52fc76bc9700f69a21f65042c805409b (diff) | |
download | open-axiom-70962cd1ef47767d4cb623a129b5c955a5aec41e.tar.gz |
* interp/define.boot (checkRepresentation): Take a second
argument. For domain extensions, warn about useless assignment to
Rep, and syntactically conflicting assignment to Rep.
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/interp/define.boot | 15 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 75696a0a..0f026bb1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2008-12-20 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * interp/define.boot (checkRepresentation): Take a second + argument. For domain extensions, warn about useless assignment to + Rep, and syntactically conflicting assignment to Rep. + 2008-12-19 Gabriel Dos Reis <gdr@cs.tamu.edu> * algebra/newdata.spad.pamphlet (SplittingNode): Define Rep as diff --git a/src/interp/define.boot b/src/interp/define.boot index 5145d76b..ab46b80c 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -182,8 +182,8 @@ insertViewMorphisms(t,e) == ++ per: Rep -> % ++ rep: % -> Rep ++ as local inline functions. -checkRepresentation: %Form -> %Form -checkRepresentation body == +checkRepresentation: (%Form,%List) -> %Form +checkRepresentation(addForm,body) == domainRep := nil hasAssignRep := false -- assume code does not assign to Rep. viewFuns := nil @@ -192,15 +192,19 @@ checkRepresentation body == -- Locate possible Rep definition for [stmt,:.] in tails body repeat - stmt is ["%LET","Rep",.] => + stmt is ["%LET","Rep",val] => domainRep ^= nil => stackAndThrow('"You cannot assign to constant domain %1b",["Rep"]) + if addForm = val then + stackWarning('"OpenAxiom suggests removing assignment to %1b",["Rep"]) + else if addForm ^= nil then + stackWarning('"%1b differs from the base domain",["Rep"]) return hasAssignRep := true stmt is ["MDEF",["Rep",:.],:.] => stackWarning('"Consider using == definition for %1b",["Rep"]) return hasAssignRep := true stmt is ["IF",.,:l] or stmt is ["SEQ",:l] or stmt is ["exit",:l] => - checkRepresentation l + checkRepresentation(addForm,l) $useRepresentationHack => return hasAssignRep := true stmt isnt ["DEF",[op,:args],sig,.,val] => nil -- skip for now. op in '(rep per) => @@ -1420,7 +1424,8 @@ compCapsule(['CAPSULE,:itemList],m,e) == $insideExpressionIfTrue: local:= false $useRepresentationHack := true clearCapsuleFunctionTable() - compCapsuleInner(checkRepresentation itemList,m,addDomain('_$,e)) + compCapsuleInner(checkRepresentation($addFormLhs,itemList),m, + addDomain('_$,e)) compSubDomain(["SubDomain",domainForm,predicate],m,e) == $addFormLhs: local:= domainForm |