all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: questioning let
Date: Wed, 24 Feb 2010 18:29:06 +0100	[thread overview]
Message-ID: <4B8561E2.2030809@easy-emacs.de> (raw)
In-Reply-To: <87vddmx3us.fsf@lola.goethe.zz>

David Kastrup wrote:
> Andreas Roehler <andreas.roehler@online.de> writes:
> 
>> Hi,
>>
>> behaviour of the example code below puzzles me. Would
>> expect setting of arg by external function, but inside
>> `let', recognised. But remains `1'.
>>
>> (defun arg-setting ()
>>   (interactive)
>>   (let ((arg 1))
>>     (message "%s" arg)
>>     (arg-extern arg)
>>     (message "%s" arg)))
>>
>> (defun arg-extern (arg)
>>   (setq arg (1- arg)))
>>
>> Any help?
> 
> The argument binding in arg-extern is the innermost one and consequently
> the only affected one.  If you make the function argument-less, it will
> likely work as expected by you, affecting the binding in arg-setting.
> 


That works, thanks a lot!
However, stored in some eil.el, get a compiler warning than:


In arg-extern:
eil.el:9:9:Warning: reference to free variable `arg'
eil.el:9:17:Warning: assignment to free variable `arg'

Would think a useless warning, as the compiler should know being inside a let (?)

Andreas




  reply	other threads:[~2010-02-24 17:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1779.1267007568.14305.help-gnu-emacs@gnu.org>
2010-02-24 11:36 ` questioning let David Kastrup
2010-02-24 17:29   ` Andreas Röhler [this message]
     [not found]   ` <mailman.1812.1267032434.14305.help-gnu-emacs@gnu.org>
2010-02-24 18:10     ` David Kastrup
2010-02-24 21:53     ` Tim X
2010-02-24 23:41     ` Pascal J. Bourguignon
2010-02-24 11:59 ` Pascal J. Bourguignon
2010-02-24 17:44   ` Andreas Röhler
2010-02-24 21:36 ` Tim X
2010-02-24 10:34 Andreas Roehler

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=4B8561E2.2030809@easy-emacs.de \
    --to=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.