aboutsummaryrefslogtreecommitdiffstats
path: root/src/lift.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-08-19 22:34:22 +0000
committerDavid Robillard <d@drobilla.net>2010-08-19 22:34:22 +0000
commit594370a2a381545aea8d0631a86f422f84ee2792 (patch)
treebe71de4a2d9ec83d634c6978daa38c76428b58e7 /src/lift.cpp
parent60f4383ee1df7c326ac887b7c1750575c3becbb8 (diff)
downloadresp-594370a2a381545aea8d0631a86f422f84ee2792.tar.gz
resp-594370a2a381545aea8d0631a86f422f84ee2792.tar.bz2
resp-594370a2a381545aea8d0631a86f422f84ee2792.zip
Generalise `cons': a call to any symbol beginning with an uppercase character
(i.e. a type symbol), e.g. (Thing 2), is a call to a type constructor which creates a Tup containing the arguments, with the symbol as the first element in the type expression, e.g. (Thing 2) has type (Thing Int) and compiles to a tuple containing a single Int. The type constructor `Tup' can be used as a `cons' replacement to construct generic tuples. git-svn-id: http://svn.drobilla.net/resp/resp@264 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/lift.cpp')
-rw-r--r--src/lift.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lift.cpp b/src/lift.cpp
index 3dd0297..939d529 100644
--- a/src/lift.cpp
+++ b/src/lift.cpp
@@ -119,7 +119,7 @@ AFn::lift(CEnv& cenv, Code& code) throw()
AType* implT = new AType(*type); // Type of the implementation function
AType* tupT = tup<AType>(loc, cenv.tenv.Tup, cenv.tenv.var(), NULL);
AType* consT = tup<AType>(loc, cenv.tenv.Tup, implT, NULL);
- ACons* cons = tup<ACons>(loc, cenv.penv.sym("cons"), implName, NULL); // Closure
+ ACons* cons = tup<ACons>(loc, cenv.penv.sym("Closure"), implName, NULL);
*(implT->begin() + 1) = implProtT;
@@ -162,10 +162,11 @@ ACall::lift(CEnv& cenv, Code& code) throw()
copy->push_front(cenv.penv.sym(cenv.liftStack.top().implName));
} else if (head()->to<AFn*>()) {
/* Special case: ((fn ...) ...)
- * Lifting (fn ...) yields: (cons _impl ...).
- * We don't want ((cons _impl ...) (cons _impl ...) ...),
- * so call the implementation function (_impl) directly:
- * (_impl (cons _impl ...) ...)
+ * Lifting (fn ...) yields: (Fn _impl ...).
+ * We don't want ((Fn _impl ...) (Fn _impl ...) ...),
+ * so call the implementation function (_impl) directly and pass the
+ * closure as the first parameter:
+ * (_impl (Fn _impl ...) ...)
*/
ACons* closure = (*copy->begin())->as<ACons*>();
ASymbol* implSym = (*(closure->begin() + 1))->as<ASymbol*>();