all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: "help-gnu-emacs@gnu.org List" <help-gnu-emacs@gnu.org>
Subject: Re: DynamicBindingVsLexicalBinding
Date: Sat, 12 Oct 2013 21:35:56 +0300	[thread overview]
Message-ID: <871u3qjq0j.fsf@yandex.ru> (raw)
In-Reply-To: <52598D4A.2010901@easy-emacs.de> ("Andreas \=\?utf-8\?Q\?R\=C3\=B6h\?\= \=\?utf-8\?Q\?ler\=22's\?\= message of "Sat, 12 Oct 2013 19:56:26 +0200")

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> http://www.emacswiki.org/emacs/DynamicBindingVsLexicalBinding
>
> it's said WRT lexical binding
>
> "Because it's (1) much easier for the user [that is, programmer], because
> it eliminates the problem of which variables lambda-expressions use
> (when they attempt to use variables from their surrounding context)"
>
> Unfortunately couldn't find a use-case where it is easier - while consenting it might be easier for the compiler to swallow.
>
> Could someone give an example, where lexical binding makes coding easier?

Consider this rather obvious higher-order function:

(defun addinator (a)
  (lambda (b)
    (+ a b)))

;; This doesn't work with dynamic binding, at all
(funcall (addinator 3) 4)

;; This returns wrong result with dynamic binding
(let ((a 42))
  (funcall (addinator 3) 4))



  reply	other threads:[~2013-10-12 18:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-12 17:56 DynamicBindingVsLexicalBinding Andreas Röhler
2013-10-12 18:35 ` Dmitry Gutov [this message]
2013-10-12 20:53   ` DynamicBindingVsLexicalBinding Drew Adams
2013-10-13  5:09     ` DynamicBindingVsLexicalBinding Thien-Thi Nguyen
2013-10-13  7:54   ` DynamicBindingVsLexicalBinding Andreas Röhler
2013-10-13 13:46     ` DynamicBindingVsLexicalBinding Kai Großjohann
2013-10-13 16:21       ` DynamicBindingVsLexicalBinding Drew Adams
2013-10-14 11:21         ` DynamicBindingVsLexicalBinding Phillip Lord
2013-10-14 13:45           ` DynamicBindingVsLexicalBinding Drew Adams
2013-10-14 16:05             ` DynamicBindingVsLexicalBinding Phillip Lord
2013-10-14 21:32           ` DynamicBindingVsLexicalBinding Kai Großjohann
2013-10-15 11:27             ` DynamicBindingVsLexicalBinding Phillip Lord
2013-10-15 20:43               ` DynamicBindingVsLexicalBinding Kai Großjohann
2013-10-16 12:57                 ` DynamicBindingVsLexicalBinding Phillip Lord
     [not found]                 ` <mailman.4127.1381928277.10748.help-gnu-emacs@gnu.org>
2013-10-16 14:26                   ` DynamicBindingVsLexicalBinding Barry Margolin
     [not found]       ` <mailman.3929.1381681317.10748.help-gnu-emacs@gnu.org>
2013-10-14 11:27         ` DynamicBindingVsLexicalBinding Rustom Mody
2013-10-14 11:15 ` DynamicBindingVsLexicalBinding Phillip Lord
     [not found] <mailman.3891.1381600459.10748.help-gnu-emacs@gnu.org>
2013-10-13  3:34 ` DynamicBindingVsLexicalBinding Barry Margolin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871u3qjq0j.fsf@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=andreas.roehler@easy-emacs.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.