unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: npostavs@gmail.com
Cc: 35546@debbugs.gnu.org, Tassilo Horn <tsdh@gnu.org>
Subject: bug#35546: 27.0.50; setf return value for new alist entries is wrong
Date: Tue, 07 May 2019 17:56:50 +0200	[thread overview]
Message-ID: <8736lqmf5p.fsf@web.de> (raw)
In-Reply-To: <85zhnyxqey.fsf@gmail.com> (npostavs@gmail.com's message of "Tue,  07 May 2019 10:58:13 -0400")

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	other threads:[~2019-05-07 15:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 13:49 bug#35546: 27.0.50; setf return value for new alist entries is wrong Tassilo Horn
2019-05-07 11:19 ` Michael Heerdegen
2019-05-07 13:43   ` Michael Heerdegen
2019-05-07 14:58     ` npostavs
2019-05-07 15:56       ` Michael Heerdegen [this message]
2019-05-07 16:50         ` npostavs
2020-04-12 12:26           ` Štěpán Němec
2020-04-12 12:34             ` Noam Postavsky
2020-04-12 12:47               ` Štěpán Němec
2020-04-13  1:01                 ` Michael Heerdegen
2020-08-19 10:34                   ` Lars Ingebrigtsen
2020-08-25 16:16                     ` Štěpán Němec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736lqmf5p.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=35546@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).