[Top][All Lists]

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

Re: dynamic and lexical scope, attempted summary with example

From: Thien-Thi Nguyen
Subject: Re: dynamic and lexical scope, attempted summary with example
Date: Mon, 21 Jul 2014 06:44:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

() Emanuel Berg <address@hidden>
() Sun, 20 Jul 2014 23:28:58 +0200

   (defun shortcut-to-file (key-prefix key file-prefix file)
     "Make shortcut with key KEY-PREFIX KEY to FILE-PREFIX FILE."
      (format "%s%s" key-prefix key)
      `(lambda ()
         (do-show-file (format "%s%s" ,file-prefix ,file)) )))

   Is this correct?

It is if it does what the designer desires.  :-D
I find ‘(format "%s%s" A B)’ unbeautiful, personally.

   2. At the 7th, last line, `file-prefix' and `file'
      appears. Those are preceded by commas so, in
      combination with the backtick, their values will be
      inserted - hard-coded. This bypasses the whole
      problem because it eliminates all evaluation of
      symbols (it is like Caesar and the Gordian
      knot). The drawback is that the lambda can't be
      byte-compiled as it is formally "just" a list.

I think using terms "insert" and "hard-coded" is confusing
in this context.  Also, "eliminated" is imprecise and thus
misleading.  To bake a cake, do you eliminate the flour?

Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

Attachment: signature.asc
Description: PGP signature

reply via email to

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