From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: Two questions about generalized variables Date: Sun, 21 Feb 2016 19:08:08 +0100 Message-ID: <878u2e9bsn.fsf@web.de> References: <87ziuu4p8k.fsf@ericabrahamsen.net> <877fhydw6q.fsf@web.de> <877fhyayzn.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1456078127 25801 80.91.229.3 (21 Feb 2016 18:08:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Feb 2016 18:08:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 21 19:08:38 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aXYQq-0006Lh-JP for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Feb 2016 19:08:32 +0100 Original-Received: from localhost ([::1]:42995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXYQp-0004Tk-T6 for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Feb 2016 13:08:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXYQe-0004Qy-Tt for help-gnu-emacs@gnu.org; Sun, 21 Feb 2016 13:08:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXYQb-00058n-Oi for help-gnu-emacs@gnu.org; Sun, 21 Feb 2016 13:08:20 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:57427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXYQb-00058b-Ho for help-gnu-emacs@gnu.org; Sun, 21 Feb 2016 13:08:17 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aXYQZ-00065A-Tl for help-gnu-emacs@gnu.org; Sun, 21 Feb 2016 19:08:15 +0100 Original-Received: from dslb-092-074-189-190.092.074.pools.vodafone-ip.de ([92.74.189.190]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Feb 2016 19:08:15 +0100 Original-Received: from michael_heerdegen by dslb-092-074-189-190.092.074.pools.vodafone-ip.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Feb 2016 19:08:15 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 31 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dslb-092-074-189-190.092.074.pools.vodafone-ip.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.91 (gnu/linux) Cancel-Lock: sha1:GenHKQYTGTy45Eqnjx2lYjFkZk0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:109248 Archived-At: Eric Abrahamsen writes: > I didn't mean symbol property lists! Just the plain old '(:key1 "value1" > :key2 "value2") kind. They're useful for a few different things -- in > this case, initializing class instances. Oh, I see. Hmm, one could define a place expander quite similarly to the one of `alist-get', I think, but it doesn't seem one to be predefined, indeed. > >> The second question is setting hashtable entries. Right now I have code > >> like this: > >> > >> (setf (gethash uuid my-hashtable) > >> (append (list (list 'thingone 'thingtwo)) > >> (gethash uuid my-hashtable))) > > > > Isn't that more or less `push'? > > I started off with `push', but the code in question doesn't know if the > key exists or not, and you can't push to nil. The gv setter is calculated using the (unevaluated) place expression, so "pushing to nil" doesn't happen. See the gv-expander of `alist-get' for example, which of course also works for nonexistent keys. Regards, Michael.