GNU bug report logs -
#38872
27.0.50; Keywords can be let-bound
Previous Next
Reported by: Thibault Polge <thibault <at> thb.lt>
Date: Thu, 2 Jan 2020 17:16:01 UTC
Severity: normal
Tags: fixed
Found in version 27.0.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #23 received at 38872 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>>> I think that should use the same condition as set_internal, so that (let
>>> ((:k :k))) still works.
>> Thanks, I forgot about that case.
>
> We should also look at what the byte-compiler does with this code.
>
> I get the impression that the best/simplest course of action is to set
> `declared_special` to `true` for keywords.
So this would be just:
diff --git a/src/lread.c b/src/lread.c
index 8064bf4d0e..f465b451a9 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4104,6 +4104,7 @@ intern_sym (Lisp_Object sym, Lisp_Object obarray, Lisp_Object index)
{
make_symbol_constant (sym);
XSYMBOL (sym)->u.s.redirect = SYMBOL_PLAINVAL;
+ XSYMBOL (sym)->u.s.declared_special = true;
SET_SYMBOL_VAL (XSYMBOL (sym), sym);
}
Which seems to work? "make check" still works after doing this, and the
test case now fails like it should do. Some more context below.
But I have to admit I don't understand why this fixes the test case. :-/
intern_sym (Lisp_Object sym, Lisp_Object obarray, Lisp_Object index)
{
Lisp_Object *ptr;
XSYMBOL (sym)->u.s.interned = (EQ (obarray, initial_obarray)
? SYMBOL_INTERNED_IN_INITIAL_OBARRAY
: SYMBOL_INTERNED);
if (SREF (SYMBOL_NAME (sym), 0) == ':' && EQ (obarray, initial_obarray))
{
make_symbol_constant (sym);
XSYMBOL (sym)->u.s.redirect = SYMBOL_PLAINVAL;
XSYMBOL (sym)->u.s.declared_special = true;
SET_SYMBOL_VAL (XSYMBOL (sym), sym);
}
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 238 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.