diff options
author | David Robillard <d@drobilla.net> | 2010-12-25 09:24:48 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-25 09:24:48 +0000 |
commit | 6dec2bd33e6c142664c881405bdc0f9b298e4a11 (patch) | |
tree | 8cc17f033c145f2a9467a2c2f56ee7b015fc1a03 /src/resp.hpp | |
parent | c1ee499d0b14be87b5f5664448507026b9b87fd6 (diff) | |
download | resp-6dec2bd33e6c142664c881405bdc0f9b298e4a11.tar.gz resp-6dec2bd33e6c142664c881405bdc0f9b298e4a11.tar.bz2 resp-6dec2bd33e6c142664c881405bdc0f9b298e4a11.zip |
Simplify let to fn, rather than deal with it through to compilation.
The previous implementation of let was a premature optimization intended to make let cheap/free, but screws up closure creation and variable indexing because a new scope is created by something other than fn.
Only compile top level expressions to globals (with associated store/retrieve overhead) in a REPL when it is necessary.
Add `do' form (ala scheme `begin') to backend (used by `match' simplify).
git-svn-id: http://svn.drobilla.net/resp/resp@348 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/resp.hpp')
-rw-r--r-- | src/resp.hpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/resp.hpp b/src/resp.hpp index 439d00b..9bc34e8 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -748,7 +748,7 @@ Engine* resp_new_c_engine(); /// Compile-Time Environment struct CEnv { CEnv(PEnv& p, TEnv& t, Engine* e, ostream& os=std::cout, ostream& es=std::cerr) - : out(os), err(es), penv(p), tenv(t), currentFn(NULL), _engine(e) + : out(os), err(es), penv(p), tenv(t), currentFn(NULL), repl(false), _engine(e) {} ~CEnv() { Object::pool.collect(GC::Roots()); } @@ -829,6 +829,8 @@ struct CEnv { CFunc currentFn; ///< Currently compiling function + bool repl; + struct FreeVars : public std::vector<const ASymbol*> { FreeVars(const ATuple* f, const std::string& n) : fn(f), implName(n) {} const ATuple* const fn; |