[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11258: 24.1.50; lexical binding inconsistencies
From: |
Stefan Monnier |
Subject: |
bug#11258: 24.1.50; lexical binding inconsistencies |
Date: |
Tue, 17 Apr 2012 13:58:32 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) |
> ; Test -*- lexical-binding: t -*-
[...]
> (defun test2 (arg)
> (interactive "i")
> ((lambda () arg)))
Yes, this is the inconsistency recently discovered in
emacs-lock-mode, indeed.
> That's strange - shouldn't the result always be nil? If not, this
> (surprising) behavior should be documented in the manual.
This is a bug in the handling of ((lambda ...) args) in lexical-binding:
the compiler treats it as (funcall #'(lambda () ...) args), whereas the
interpreter treats it as (funcall '(lambda () ...) args), so the
lambda's body is treated as lexically scoped when compiled but
dynamically scoped when interpreted.
I think the compiler is right, so the interpreter needs fixing. I'm not
completely sure it will be harmless, so it won't be fixed in 24.1.
Stefan