From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: master baf1a7a4a0: Turn gv-synthetic-place into a function Date: Wed, 21 Sep 2022 15:52:42 +0200 Message-ID: <87edw4bzrp.fsf@web.de> References: <835yhkzmn8.fsf@gnu.org> <878rmfx51p.fsf@web.de> <831qs7zj9e.fsf@gnu.org> <87v8piec78.fsf@web.de> <834jx2xphy.fsf@gnu.org> <878rmenmd4.fsf@web.de> <87sfklgmba.fsf@dataswamp.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34353"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: emacs-devel@gnu.org Cancel-Lock: sha1:nTLDRU6OUumuZsz7xABm/rvULGk= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 21 16:07:33 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ob0Nx-0008gh-Qk for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Sep 2022 16:07:33 +0200 Original-Received: from localhost ([::1]:50594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ob0Nw-0002hK-Mh for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Sep 2022 10:07:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ob09q-0004jy-Il for emacs-devel@gnu.org; Wed, 21 Sep 2022 09:52:58 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:45724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ob09k-0002IJ-4x for emacs-devel@gnu.org; Wed, 21 Sep 2022 09:52:58 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1ob09h-00095o-Lk for emacs-devel@gnu.org; Wed, 21 Sep 2022 15:52:49 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:295912 Archived-At: Emanuel Berg writes: > Michael Heerdegen wrote: > > > A generalized variable is a place (form). You use a function > > in a place form like you use it in any (normal) form. > > Just the semantics are different. Like in > > > > (car (gv-synthetic-place ...)) > > OK, so we have symbols that have one slot for a/the function > and another for the variable and this is some third > thing then? Not really. Note that `gv-synthetic-place' is a corner case construct that is useful mostly as a helper or to implement support for more common generalized variables. There are currently 0 uses in Emacs. For place forms in general: the idea is that the language allows you to wrap a normal form that describes the place of a value - like e.g. (car (alist-get ...))) - into `setf' (or any other place macro) and that magically allows you to modify or bind that value. With other words: you abstract over the concepts "getter" and "setter" functions, since they are mirror images in a larger concept, and get something _simpler_: you then need to remember less function names and are allowed to write simpler code. Place forms are like normal forms, but only forms that describe the place of a value and have support as generalized variables are valid as place forms. The semantics are different of course since they are not exactly evaluated like normal Lisp. They are transformed before evaluation happens, but that is something very common in Lisp. Lisp programmers are used to the fact that not every list in a Lisp program is evaluated in the standard way. Think of arguments macros and special forms. Not everything is an expression. (1 2) in '(1 2) is not an expression meant for evaluation, for example. For place forms you even don't have to learn new syntax. There is no additional third thing where stuff is stored...so I would say my answer to your question is "no". Please don't get distracted by the discussion of this internal corner case thing. Michael.