aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@axiomatics.org>2016-01-06 04:59:53 -0800
committerGabriel Dos Reis <gdr@axiomatics.org>2016-01-06 04:59:53 -0800
commit390e8b6664a6e5fd58111b8d650d176825a877d3 (patch)
tree305ba29822c5b2dab625f6de0e4de942a0270e32
parent32d2c2039d6c3650f1c4ce6d9cd04df8000e66b3 (diff)
downloadopen-axiom-390e8b6664a6e5fd58111b8d650d176825a877d3.tar.gz
macroExpand: Do not expand the definiendum in a definition.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/interp/define.boot10
2 files changed, 10 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f5cd62a3..89e40198 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-06 Gabriel Dos Reis <gdr@axiomatics.org>
+
+ * interp/define.boot (macroExpand): Do not expand the definiendum,
+ except parameter types, in a definition.
+
2015-12-31 Gabriel Dos Reis <gdr@axiomatics.org>
* interp/compiler.boot (coerceEasy): Allow expansion of current
diff --git a/src/interp/define.boot b/src/interp/define.boot
index 1ec07745..c6cf8942 100644
--- a/src/interp/define.boot
+++ b/src/interp/define.boot
@@ -1,6 +1,6 @@
-- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd.
-- All rights reserved.
--- Copyright (C) 2007-2015, Gabriel Dos Reis.
+-- Copyright (C) 2007-2016, Gabriel Dos Reis.
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
@@ -918,8 +918,8 @@ giveFormalParametersValues(argl,e) ==
e
-macroExpandInPlace: (%Form,%Env) -> %Form
-macroExpandInPlace(x,e) ==
+macroExpand!: (%Form,%Env) -> %Form
+macroExpand!(x,e) ==
y:= macroExpand(x,e)
x isnt [.,:.] or y isnt [.,:.] => y
x.first := first y
@@ -934,7 +934,7 @@ macroExpand(x,e) == --not worked out yet
u is ['%mlambda,:.] => x
macroExpand(u,e)
x is ['DEF,lhs,sig,rhs] =>
- ['DEF,macroExpand(lhs,e),macroExpandList(sig,e),macroExpand(rhs,e)]
+ ['DEF,lhs,macroExpandList(sig,e),macroExpand(rhs,e)]
-- macros should override niladic props
[op,:args] := x
ident? op and args = nil and niladicConstructor? op and
@@ -2353,7 +2353,7 @@ compCapsuleItems(db,itemlist,$predl,$e) ==
$e
compSingleCapsuleItem(db,item,$predl,$e) ==
- doIt(db,macroExpandInPlace(item,$e),$predl)
+ doIt(db,macroExpand!(item,$e),$predl)
$e