aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/interp/define.boot15
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