bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#35546: 27.0.50; setf return value for new alist entries is wrong


From: Michael Heerdegen
Subject: bug#35546: 27.0.50; setf return value for new alist entries is wrong
Date: Tue, 07 May 2019 17:56:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

npostavs@gmail.com writes:

> I think the rationale goes like this:
>
> Suppose you want to *get* the bottom 4 bits of PLACE, you do
>
>     (logand PLACE #x0F)
>
>     ;; Example:
>     (let ((var #xABCD))
>       (logand var #x0F)) ;=> #xD
>
> Suppose you want to *set* the bottom 4 bits of PLACE, you do
>
>     (setf (logand PLACE #x0F) VALUE)
>
>     ;; Example:
>     (let ((var #xABCD))
>       (setf (logand var #x0F) 9)
>       var) ;=> #xABC9

Ah, ok, thanks.  So, from all solutions it takes that one with the least
changes to the bits of PLACE.

If the setter code would be more like

  (funcall setter `(logif ,mask ,v ,getter))

it would be better readable, with the disadvantage that it would not
work any more.

Anyway, there is no reason that the setter currently does not return V,
right?


Thanks,

Michael.





reply via email to

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