|
Practical Common LispYou can see how your implementation does it by evaluating this form: (macroexpand-1 '(with-slots (x y z) obj (list x y z))) However, walking the body is much easier for the Lisp implementation to do than for user code; to replace x, y, and z only when they appear in value positions requires a code walker that understands the syntax of all special operators and that recursively expands all macro forms in order to determine whether their expansions include the symbols in value positions. The Lisp implementation obviously has such a code walker at its disposal, but it's one of the few parts of Lisp that's not exposed to users of the language. 210 One version of f2cl is available as part of the Common Lisp Open Code Collection (CLOCC): By contrast, consider the tricks the authors of f2j, a FORTRAN-to-Java translator, have to play. Although the Java Virtual Machine (JVM) has a goto instruction, it's not directly exposed in Java. So to compile FORTRAN gotos, they first compile the FORTRAN code into legal Java source with calls to a dummy class to represent the labels and gotos ...» |
Код для вставки книги в блог HTML
phpBB
текст
|
|