[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lexical byte-compilation warnings cleanup
From: |
Daniel Colascione |
Subject: |
Re: Lexical byte-compilation warnings cleanup |
Date: |
Sun, 15 Sep 2013 12:33:35 -0700 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 |
On 8/20/13 9:49 PM, Stefan Monnier wrote:
>>>> And the intention is? The design is? The reason is?
>
> Check the calling convention used by the new byte-code representation
> (used for lexically scoped code) and you'll see that there's no support
> for dynamic scoping in it. Adding such support "natively" would
> slow down the common case too much.
I think the current design is reasonable, and the byte-compiler warning
provides some safety. We do, however, need to provide some warnings in
cl-lib, because in some cases, we _can_ dynamically bind arguments.
Consider this code:
(defvar test (cons 1 2))
(defun* bar3 () (car test))
(defun* bar2 (&key test) (bar3))
(defun* bar1 () (bar2 :test (cons 3 4)))
When bar2 parses its argument list, is _dynamically_ binds test, which
test then picks up. bar1 returns 3. If we change test from a keyword
argument to a regular argument, bar1 then returns 1, as expected.
signature.asc
Description: OpenPGP digital signature