freenode/#sicl - IRC Chatlog
Search
18:31:07
fiddlerwoaroof
Is there an existing mechanism to run Cleavir's optimization passes on a bit of code and then produce lisp as the output?
4:48:47
no-defun-allowed
What does an environment which has been restricted for MACROLET expanders provide which the global environment does not?
5:06:27
no-defun-allowed
Hm, SICL/Code/Boot/environment.lisp has a method for RESTRICT-FOR-MACROLET-EXPANDER which does nothing.
5:20:05
beach
Aha, so the restriction doesn't work, which may be the reason this bug has not been detected.
5:26:28
beach
I am still not convinced about the quote we added the other day, but if we can get the thing past MIR-to-LIR, that problem can wait until later. Though if you feel like looking into it, that's fine as well.
5:27:01
no-defun-allowed
Currently I have modified TRUCLER:QUASI-CLONE to break when a restricted environment is cloned and the new environment isn't restricted, and there are such cases.
5:29:35
beach
Is it OK with you to dive into things in this level of detail? I mean, I am delighted that you do this because it would mean more people know this stuff. But you should tell me if you would rather do just register allocation.
5:30:35
no-defun-allowed
But that is incorrect when we attempt to describe variables that should be available to the expander function, such as the implicit #:whole and #:environment arguments.
5:32:29
no-defun-allowed
Although the error would be less specific, restricting could also be done by removing lexical variable and local function descriptions from the environment.
5:34:16
no-defun-allowed
It is done by setting a RESTRICTED-P slot in the environment, and every DESCRIBE-thing method checks that it does not return a lexical variable or local function description from a restricted environment.
5:35:32
no-defun-allowed
A quick test with this implementation of restricting produces the error "The variable X is unbound." on the example of (let ((x 2)) (macrolet ((f () x)) (f)))
5:38:43
no-defun-allowed
Yes, though detecting that the macro function attempted to use a local variable would be nice. SBCL mentions it: "The variable X is unbound. It is a local variable not available at compile-time."
5:39:41
beach
Yes, that would be better. The most important part is detecting a problem so that bugs don't propagate, though.
5:53:59
no-defun-allowed
It doesn't seem right still. Currently, the macro function is evaluated in the restricted local environment. But I don't know what local information is used in compiling the macro function.
5:55:56
no-defun-allowed
The HyperSpec says "Declarations and macrolet and symbol-macrolet definitions affect the local macro definitions in a macrolet, but the consequences are undefined if the local macro definitions reference any local variable or function bindings that are visible in that lexical environment."
5:58:37
no-defun-allowed
Now I see that we keep local macro definitions, so that (macrolet ((f () 'x)) (macrolet ((g (x) (f))) (g 5))) would work.