[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#38872: 27.0.50; Keywords can be let-bound
From: |
Lars Ingebrigtsen |
Subject: |
bug#38872: 27.0.50; Keywords can be let-bound |
Date: |
Sun, 20 Sep 2020 12:36:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier <monnier@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
- bug#38872: 27.0.50; Keywords can be let-bound,
Lars Ingebrigtsen <=