help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: hooks and let-bound variables


From: tomas
Subject: Re: hooks and let-bound variables
Date: Wed, 24 Jun 2015 17:48:08 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Jun 24, 2015 at 07:44:33AM -0700, Drew Adams wrote:
> > I find very funny that I only use languages with lexical binding,
> > but can still be bitten by it in emacs-lisp.
> 
> ;-)
> 
> Yup.  If you have only lexical binding then you cannot be bitten
> by it (or by dynamic binding).
> 
> Emacs makes (good) use of dynamic binding, for exactly the kind
> of thing you were doing: let-binding around some code whose behavior
> you want to change by way of the binding.
> 
> In most languages you do not ever want the behavior of existing code
> to change at runtime by just changing the value of a global variable
> (i.e, from outside that code).  With Common Lisp and Emacs Lisp you
> do sometimes want that.

Perl is another language with dual binding: it started out with "local"
(dynamically bound, in good ol' shell tradition) and then grew (I
think it's an appropriate term for Perl ;-) "my" for lexical binding,
with all the niceness of closures, etc.

Then, loads of well-meant advice ("never use 'local', you want 'my'").
I think a language having both is a very nice trait.

- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlWK0TcACgkQBcgs9XrR2kYXwwCfV6wP6C6nUaMgSKH0D7RFjEsH
tUEAnAxjn/I0YgjWz36tjLsBCh4QgLWY
=0mcS
-----END PGP SIGNATURE-----



reply via email to

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