unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnu.org>
To: David Edmondson <dme@dme.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH v1] Fix errors generated when multiple IRC clients talk to a single IRC proxy.
Date: Wed, 15 Oct 2014 08:58:55 +0200	[thread overview]
Message-ID: <87wq81om34.fsf@zigzag.favinet> (raw)
In-Reply-To: <cuna9551qle.fsf@gargravarr.hh.sledj.net> (David Edmondson's message of "Wed, 8 Oct 2014 15:03:17 +0100")

[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]

() David Edmondson <dme@dme.org>
() Wed, 8 Oct 2014 15:03:17 +0100

   +  (when erc-channel-new-member-names
   +    (maphash (lambda (nick user)
   +	       (if (null (gethash nick erc-channel-new-member-names))
   +		   (erc-remove-channel-user nick)))
   +	     erc-channel-users)
   +    (setq erc-channel-new-member-names nil)))

I don't know if this is the case for Emacs Lisp, but i've been
burned when (and am thus now leery of) doing a destructive
operation on the hash table while hash walking, elsewhere
(here, ‘erc-remove-channel-user’ boils down to ‘remhash’).

Better to restructure as two passes: accumulation + destruction.
That way, we cleanly avoid a bug, whether manifest or latent.

(Someone will now point out how the hash table impl avoids this
problem entirely.  Well, good!  That just shifts the "bug" to
one of documenting this guarantee, which is easier to fix short
term, but perhaps harder to live w/ long term (e.g., when Emacs
is rebased on Guile).  "But ttn your words are vague, are you
trying to be obtuse?"  Yes, and both right and wrong, too!  :-D)

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2014-10-15  6:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08 14:03 [PATCH v1] Fix errors generated when multiple IRC clients talk to a single IRC proxy David Edmondson
2014-10-15  6:58 ` Thien-Thi Nguyen [this message]
2014-10-15  7:06   ` Thien-Thi Nguyen
2014-10-15  7:58   ` David Edmondson
2014-10-15 13:54   ` Stefan Monnier
2014-10-15 15:50 ` Mirek Kaim

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=87wq81om34.fsf@zigzag.favinet \
    --to=ttn@gnu.org \
    --cc=dme@dme.org \
    --cc=emacs-devel@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).