* [PATCH] Fix (letrec ((ignore)))
@ 2015-12-11 16:11 Zack Piper
2015-12-11 20:08 ` Kaushal Modi
0 siblings, 1 reply; 14+ messages in thread
From: Zack Piper @ 2015-12-11 16:11 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 223 bytes --]
Org mode uses `(letrec ((ignore)) ...)' a few times, this introduces
compatibility after the recent setq changed which stopped an
odd number of arguments being passed.
--
Zack Piper <zack@apertron.net> http://apertron.net
[-- Attachment #2: 0001-Fix-letrec-and-ignore-producing-an-odd-numbered-call.patch --]
[-- Type: text/plain, Size: 1160 bytes --]
From df31b93604b28ee9b098280907fb8d5c12710b63 Mon Sep 17 00:00:00 2001
From: Zack Piper <zack.piper123@gmail.com>
Date: Fri, 11 Dec 2015 16:00:37 +0000
Subject: [PATCH] Fix `letrec' and `(ignore)' producing an odd-numbered call to
`setq'.
Revision 5d93a89e805baa2f29941fd801e48235f6c1a6b6 introduces a change to
`setq' where it no longer accepts an odd amount of arguments. Org mode
uses `(letrec ((ignore)) ...)' a few times and other packages might do
the same.
Copyright-paperwork-exempt: yes
---
lisp/subr.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/subr.el b/lisp/subr.el
index 860c14c..e8ba4d8 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1500,7 +1500,10 @@ letrec
;; making the vars actually unbound during evaluation of the binders).
(declare (debug let) (indent 1))
`(let ,(mapcar #'car binders)
- ,@(mapcar (lambda (binder) `(setq ,@binder)) binders)
+ ,@(mapcar (lambda (binder)
+ (if (second binder)
+ `(setq ,@binder)
+ `(setq ,@binder nil))) binders)
,@body))
(defmacro with-wrapper-hook (hook args &rest body)
--
2.6.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix (letrec ((ignore)))
2015-12-11 16:11 [PATCH] Fix (letrec ((ignore))) Zack Piper
@ 2015-12-11 20:08 ` Kaushal Modi
2015-12-12 23:10 ` John Wiegley
0 siblings, 1 reply; 14+ messages in thread
From: Kaushal Modi @ 2015-12-11 20:08 UTC (permalink / raw)
To: Zack Piper; +Cc: Emacs developers
On Fri, Dec 11, 2015 at 11:11 AM, Zack Piper <zack@apertron.net> wrote:
> Org mode uses `(letrec ((ignore)) ...)' a few times, this introduces
Would it be better instead to fix the org-mode files for consistency?
- Replace all instances of
(letrec ((SOMEVAR)) ..)
with
(letrec ((SOMEVAR nil)) ..)
Question to emacs-devel: What would be the right approach?
--
Kaushal Modi
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix (letrec ((ignore)))
2015-12-11 20:08 ` Kaushal Modi
@ 2015-12-12 23:10 ` John Wiegley
2015-12-13 4:08 ` Kyle Meyer
2015-12-13 12:13 ` Alan Mackenzie
0 siblings, 2 replies; 14+ messages in thread
From: John Wiegley @ 2015-12-12 23:10 UTC (permalink / raw)
To: Kaushal Modi
Cc: Artur Malabarba, Zack Piper, Aurélien Aptel,
Emacs developers
[-- Attachment #1: Type: text/plain, Size: 777 bytes --]
>>>>> Kaushal Modi <kaushal.modi@gmail.com> writes:
> Would it be better instead to fix the org-mode files for consistency?
> - Replace all instances of
> (letrec ((SOMEVAR)) ..)
> with
> (letrec ((SOMEVAR nil)) ..)
(letrec ((SOMEVAR))) should be an error, since the value is missing. If one
wishes to declare SOMEVAR with a nil value, the correct forms are:
(letrec ((SOMEVAR nil)))
(letrec (SOMEVAR))
> Question to emacs-devel: What would be the right approach?
We should give `letrec' the same treatment we've given to `setq' and `setf',
and then Org and other users should be corrected.
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 629 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix (letrec ((ignore)))
2015-12-12 23:10 ` John Wiegley
@ 2015-12-13 4:08 ` Kyle Meyer
2015-12-13 12:13 ` Alan Mackenzie
1 sibling, 0 replies; 14+ messages in thread
From: Kyle Meyer @ 2015-12-13 4:08 UTC (permalink / raw)
To: Emacs developers
Cc: Artur Malabarba, Zack Piper, Aurélien Aptel, Kaushal Modi
John Wiegley <jwiegley@gmail.com> writes:
> (letrec ((SOMEVAR))) should be an error, since the value is missing. If one
> wishes to declare SOMEVAR with a nil value, the correct forms are:
>
> (letrec ((SOMEVAR nil)))
> (letrec (SOMEVAR))
Doesn't the second form currently signal an error?
> and then Org and other users should be corrected.
Should be fixed in the Org repo as of f57778090.
--
Kyle
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix (letrec ((ignore)))
2015-12-12 23:10 ` John Wiegley
2015-12-13 4:08 ` Kyle Meyer
@ 2015-12-13 12:13 ` Alan Mackenzie
2015-12-13 17:41 ` Drew Adams
2015-12-14 18:23 ` John Wiegley
1 sibling, 2 replies; 14+ messages in thread
From: Alan Mackenzie @ 2015-12-13 12:13 UTC (permalink / raw)
To: Kaushal Modi, Zack Piper, Artur Malabarba, Aurélien Aptel,
Emacs developers
Hello, John.
On Sat, Dec 12, 2015 at 03:10:05PM -0800, John Wiegley wrote:
> >>>>> Kaushal Modi <kaushal.modi@gmail.com> writes:
> > Would it be better instead to fix the org-mode files for consistency?
> > - Replace all instances of
> > (letrec ((SOMEVAR)) ..)
> > with
> > (letrec ((SOMEVAR nil)) ..)
> (letrec ((SOMEVAR))) should be an error, since the value is missing. If one
> wishes to declare SOMEVAR with a nil value, the correct forms are:
> (letrec ((SOMEVAR nil)))
> (letrec (SOMEVAR))
> > Question to emacs-devel: What would be the right approach?
> We should give `letrec' the same treatment we've given to `setq' and `setf',
> and then Org and other users should be corrected.
Just as a matter of interest,
(let ((foo) ... ) ...)
is accepted by the interpreter and byte compiler, binding foo to nil.
Should we make that form invalid, too?
> --
> John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
> http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH] Fix (letrec ((ignore)))
2015-12-13 12:13 ` Alan Mackenzie
@ 2015-12-13 17:41 ` Drew Adams
2015-12-13 22:19 ` Kaushal Modi
2015-12-14 18:23 ` John Wiegley
1 sibling, 1 reply; 14+ messages in thread
From: Drew Adams @ 2015-12-13 17:41 UTC (permalink / raw)
To: Alan Mackenzie, Kaushal Modi, Zack Piper, Artur Malabarba,
Aurélien Aptel, Emacs developers
> (let ((foo) ... ) ...)
>
> is accepted by the interpreter and byte compiler, binding foo to nil.
> Should we make that form invalid, too?
Of course not. It is helpful to a (human) reader to distinguish
the use of a `(foo nil)' let-binding from a `(foo)' let-binding.
Some coders use the convention that showing the nil initial
value explicitly indicates that this is the initialization,
whereas `(foo)' indicates that the `let' body will perform
the (real, significant) initialization.
From "Common Lisp, The Language", section Establishing New
Variable Bindings:
"Instead of a list (varj valuej), one may write simply varj.
In this case varj is initialized to nil. As a matter of style,
it is recommended that varj be written only when that variable
will be stored into (such as by setq) before its first use.
If it is important that the initial value be nil rather than
some undefined value, then it is clearer to write out (varj nil)
if the initial value is intended to mean ``false,'' or
(varj '()) if the initial value is intended to be an empty list."
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix (letrec ((ignore)))
2015-12-13 12:13 ` Alan Mackenzie
2015-12-13 17:41 ` Drew Adams
@ 2015-12-14 18:23 ` John Wiegley
2015-12-14 20:24 ` Alan Mackenzie
1 sibling, 1 reply; 14+ messages in thread
From: John Wiegley @ 2015-12-14 18:23 UTC (permalink / raw)
To: Alan Mackenzie
Cc: Artur Malabarba, Zack Piper, Emacs developers,
Aurélien Aptel, Kaushal Modi
[-- Attachment #1: Type: text/plain, Size: 748 bytes --]
>>>>> Alan Mackenzie <acm@muc.de> writes:
> Just as a matter of interest,
> (let ((foo) ... ) ...)
> is accepted by the interpreter and byte compiler, binding foo to nil.
In the spirit of our recent clarifications, I think it should also be made an
error, rather than an implicit binding to nil.
I have a feeling there are still many more places where this behavior exists,
and we are just beginning to scratch the surface. For example:
(dolist ((i)) (message "Hello"))
Is also accepted as a "do nothing" block, when it should give an error about a
missing value.
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 629 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix (letrec ((ignore)))
2015-12-14 18:23 ` John Wiegley
@ 2015-12-14 20:24 ` Alan Mackenzie
2015-12-14 20:25 ` John Wiegley
0 siblings, 1 reply; 14+ messages in thread
From: Alan Mackenzie @ 2015-12-14 20:24 UTC (permalink / raw)
To: Kaushal Modi, Zack Piper, Artur Malabarba, Aurélien Aptel,
Emacs developers
Hello, John.
On Mon, Dec 14, 2015 at 10:23:38AM -0800, John Wiegley wrote:
> >>>>> Alan Mackenzie <acm@muc.de> writes:
> > Just as a matter of interest,
> > (let ((foo) ... ) ...)
> > is accepted by the interpreter and byte compiler, binding foo to nil.
> In the spirit of our recent clarifications, I think it should also be made an
> error, rather than an implicit binding to nil.
I should have checked before writing my last contribution, but (let
((foo) ...) ...) is actually documented as permissible in the Elisp
manual.
That weakens considerably the case for making it invalid.
> I have a feeling there are still many more places where this behavior exists,
> and we are just beginning to scratch the surface. For example:
> (dolist ((i)) (message "Hello"))
> Is also accepted as a "do nothing" block, when it should give an error about a
> missing value.
Outch, that's confusing.
> --
> John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
> http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix (letrec ((ignore)))
2015-12-14 20:24 ` Alan Mackenzie
@ 2015-12-14 20:25 ` John Wiegley
2015-12-14 20:47 ` David Kastrup
0 siblings, 1 reply; 14+ messages in thread
From: John Wiegley @ 2015-12-14 20:25 UTC (permalink / raw)
To: Alan Mackenzie
Cc: Artur Malabarba, Zack Piper, Emacs developers,
Aurélien Aptel, Kaushal Modi
>>>>> Alan Mackenzie <acm@muc.de> writes:
> I should have checked before writing my last contribution, but (let ((foo)
> ...) ...) is actually documented as permissible in the Elisp manual.
> That weakens considerably the case for making it invalid.
Perhaps this is a bug both in the code and the manual? What say others?
>> Is also accepted as a "do nothing" block, when it should give an error
>> about a missing value.
> Outch, that's confusing.
Yes, I'd like to achieve consistency here, if it's not going to harm things.
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix (letrec ((ignore)))
2015-12-14 20:25 ` John Wiegley
@ 2015-12-14 20:47 ` David Kastrup
2015-12-14 21:55 ` John Wiegley
2015-12-15 14:14 ` Alan Mackenzie
0 siblings, 2 replies; 14+ messages in thread
From: David Kastrup @ 2015-12-14 20:47 UTC (permalink / raw)
To: Alan Mackenzie
Cc: Artur Malabarba, Zack Piper, Emacs developers,
Aurélien Aptel, Kaushal Modi
John Wiegley <jwiegley@gmail.com> writes:
>>>>>> Alan Mackenzie <acm@muc.de> writes:
>
>> I should have checked before writing my last contribution, but (let ((foo)
>> ...) ...) is actually documented as permissible in the Elisp manual.
>
>> That weakens considerably the case for making it invalid.
>
> Perhaps this is a bug both in the code and the manual? What say others?
It's awful as far as I'm concerned. But being documented and available
for a long time, deprecating it is a slow process, starting with
undocumenting it and giving byte compiler warnings.
I'd not mind getting it on the way.
--
David Kastrup
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix (letrec ((ignore)))
2015-12-14 20:47 ` David Kastrup
@ 2015-12-14 21:55 ` John Wiegley
2015-12-15 14:14 ` Alan Mackenzie
1 sibling, 0 replies; 14+ messages in thread
From: John Wiegley @ 2015-12-14 21:55 UTC (permalink / raw)
To: David Kastrup
Cc: Aurélien Aptel, Artur Malabarba, Zack Piper,
Emacs developers, Kaushal Modi, Alan Mackenzie
>>>>> David Kastrup <dak@gnu.org> writes:
> It's awful as far as I'm concerned. But being documented and available for a
> long time, deprecating it is a slow process, starting with undocumenting it
> and giving byte compiler warnings.
We haven't taken that approach with setq/setf, but I'm fine either way. I'm
also willing to leave this one alone until it starts biting someone, since I
imagine letrec is far less commonly used.
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fix (letrec ((ignore)))
2015-12-14 20:47 ` David Kastrup
2015-12-14 21:55 ` John Wiegley
@ 2015-12-15 14:14 ` Alan Mackenzie
1 sibling, 0 replies; 14+ messages in thread
From: Alan Mackenzie @ 2015-12-15 14:14 UTC (permalink / raw)
To: David Kastrup
Cc: Artur Malabarba, Zack Piper, Kaushal Modi, Aurélien Aptel,
Emacs developers
Hello, David.
On Mon, Dec 14, 2015 at 09:47:49PM +0100, David Kastrup wrote:
> John Wiegley <jwiegley@gmail.com> writes:
> >>>>>> Alan Mackenzie <acm@muc.de> writes:
> >> I should have checked before writing my last contribution, but (let ((foo)
> >> ...) ...) is actually documented as permissible in the Elisp manual.
> >> That weakens considerably the case for making it invalid.
> > Perhaps this is a bug both in the code and the manual? What say others?
> It's awful as far as I'm concerned. But being documented and available
> for a long time, deprecating it is a slow process, starting with
> undocumenting it and giving byte compiler warnings.
I've just tried putting a diagnostic into the compiler. A make
bootstrap turned up 225 occurences of ((foo)) style bindings.
As you say, getting rid of them will be a slow process. :-(
> I'd not mind getting it on the way.
> --
> David Kastrup
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-12-15 14:14 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-11 16:11 [PATCH] Fix (letrec ((ignore))) Zack Piper
2015-12-11 20:08 ` Kaushal Modi
2015-12-12 23:10 ` John Wiegley
2015-12-13 4:08 ` Kyle Meyer
2015-12-13 12:13 ` Alan Mackenzie
2015-12-13 17:41 ` Drew Adams
2015-12-13 22:19 ` Kaushal Modi
2015-12-13 23:05 ` Drew Adams
2015-12-14 18:23 ` John Wiegley
2015-12-14 20:24 ` Alan Mackenzie
2015-12-14 20:25 ` John Wiegley
2015-12-14 20:47 ` David Kastrup
2015-12-14 21:55 ` John Wiegley
2015-12-15 14:14 ` Alan Mackenzie
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).