all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Nicolas Richard <theonewiththeevillook@yahoo.fr>,
	emacs-devel@gnu.org, Alan Mackenzie <acm@muc.de>
Subject: Re: Trouble with lexical-binding.
Date: Thu, 16 Apr 2015 19:34:39 +0200	[thread overview]
Message-ID: <87d234nfio.fsf@yahoo.fr> (raw)
In-Reply-To: jwvr3rllatm.fsf-monnier+emacs@gnu.org

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
> But if you have a file foo.el with
>
>    ;;; - lexical-binding:t -*-
>    (defun foo (x)
>      (let ((ptr x))
>        (lambda (y) (+ ptr y))))
>
> and a file bar.el with
>
>    ;;; - lexical-binding:t -*-
>    (defvar ptr)
>    (defun bar ()
>      (let* ((ptr 6)
>             (f (foo 3)))
>        (message "%S" (funcall f 1))))
>
> Then
>
>     emacs -Q --batch -l ~/tmp/foo.elc -l ~/tmp/bar.el --eval '(bar)'
> and
>     emacs -Q --batch -l ~/tmp/foo.el -l ~/tmp/bar.el --eval '(bar)'
>
> won't give you the same answer :-(

I can't reproduce : I get 7 in both cases. (I used "emacs --batch -f
batch-byte-compile foo.el" to get foo.elc.)

If I fix the first line of these files to actually use lexbind like so:
;;; -*- lexical-binding:t -*-
and recompile, I then get 4 in both cases.

Did I miss something ?

-- 
Nicolas



  reply	other threads:[~2015-04-16 17:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 22:03 Trouble with lexical-binding Alan Mackenzie
2015-04-13 22:19 ` Philipp Stephani
2015-04-14 14:03   ` Alan Mackenzie
2015-04-14 16:53     ` Stefan Monnier
2015-04-15 13:44       ` Alan Mackenzie
2015-04-15 14:34         ` Stefan Monnier
2015-04-13 22:28 ` Stefan Monnier
2015-04-15 13:48   ` Nicolas Richard
2015-04-15 14:44     ` Stefan Monnier
2015-04-16 17:34       ` Nicolas Richard [this message]
2015-04-16 18:43         ` Stefan Monnier

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=87d234nfio.fsf@yahoo.fr \
    --to=theonewiththeevillook@yahoo.fr \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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.