Hi everyone, I'm writing a simple scheme compiler for educational purposes, and I'm getting confused over "compile-time" versus. "run-time". If someone could offer a simple explanation that would be greatly appreciated.
I don't understand when macros are expanded. Low-level LISP style macros in particular. 1) I assume that all macros are expanded before compilation. 2) This raises the question about macros that are defined within the actual file to be compiled. 3) I guess that we scan through the file first to see what macros are defined? 4) But then what if the macros call a function that is also defined with the file? 5) Then we should scan through the file and see what functions are defined also. 6) What if the behaviour of the function is affected by a variable that's changed at runtime? What should happen when I compile this?: (define (reverse list) (println "WILL I SEE THIS DURING COMPILE-TIME?") (if (null? args) '() (append (reverse (cdr list)) (car list)))) (defmacro (reversely . args) (reverse args)) (reversely ("WILL I SEE THIS DURING RUN-TIME?" println)) Thanks for your help -Patrick
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users