1 Copyright (c) 2013 Robert Virding 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 15 16Implementation Notes 17-------------------- 18 19Translating LFE <-> Erlang 20-------------------------- 21 22The only complications are handling the variable scoping and 23converting between them. Some example cases: 24 25X = b(x), (progn 26X = c(y), (let ((X (when) (b 'x))) 27a(X, X). (let ((---0--- (when (=:= X ---0---)) (c 'y))) 28 (a X X)))) 29 30Can only handle case of binding variable at "top level" in 31expressions, nested expressions need to be flattened which introduces 32a whole new level of complexity. 33 34(let ((X (f 1))) X = f(1), 35 (a X) a(X), 36 (let ((X (g X))) ___0___ = g(X), 37 (b X)) b(___0___), 38 (c X)) c(X) 39 40This is much easier as variables can never "escape" their scope, we 41just have to generate unique variable names. 42