emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with lexical-binding.


From: Nicolas Richard
Subject: Re: Trouble with lexical-binding.
Date: Wed, 15 Apr 2015 15:48:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:
> But the fix is easy: declare that `ptr' should be a dynamically scoped
> variable with a simple:
>
>     (defvar ptr)
>
> Of course, doing so is strongly discouraged, since it could break other
> code which uses `ptr' and expects lexical binding for it.

I don't think it can break code defined elsewhere : the (defvar ptr)
form only has effect in its lexical scope, unlike the 2+ arguments
versions where a default value is provided.

(defvar ptr) => ptr
(special-variable-p 'ptr) => nil
(defvar ptr nil) => ptr
(special-variable-p 'ptr) => t

-- 
Nicolas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]