From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Using funcall on inline functions Date: Sat, 12 Dec 2020 14:49:28 -0800 Message-ID: <87bleyd4hz.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36872"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Cancel-Lock: sha1:gV9W8hzS7zfQAQCk8OPLuW8BbP0= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 12 23:50:56 2020 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 1koDj6-0009Wl-Ac for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Dec 2020 23:50:56 +0100 Original-Received: from localhost ([::1]:52160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koDj5-0003LT-D2 for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Dec 2020 17:50:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koDi0-0002ao-Fb for emacs-devel@gnu.org; Sat, 12 Dec 2020 17:49:48 -0500 Original-Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214]:58116 helo=ciao.gmane.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koDhy-0001Ty-KM for emacs-devel@gnu.org; Sat, 12 Dec 2020 17:49:48 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1koDhu-0008IL-GB for emacs-devel@gnu.org; Sat, 12 Dec 2020 23:49:42 +0100 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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.23 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:260735 Archived-At: I might be doing something wrong here, but I'm having trouble using funcall+inline+general variable. I thought that one of the advantages of an inline was that they were effectively defined as both macros and functions. It's a slightly convoluted situation, bear with me, here's the simplest I can get it: (cl-defstruct ebdb-record-cache (alt-names nil :type list)) (defclass ebdb-record () ((cache :type ebdb-record-cache))) (define-inline ebdb-record-alt-names (record) (inline-quote (ebdb-record-cache-alt-names (slot-value,record 'cache)))) (define-inline ebdb-add-to-list (list-var element) (inline-quote (when, element (cl-pushnew, element, list-var :test #'equal)))) (let ((listfunc #'ebdb-add-to-list) (name-string "Bob's new name")) (funcall listfunc (ebdb-record-alt-names ) name-string)) Maybe this a bit overboard in terms of indirection, but it ought to work, yes? What happens is that the funcall form returns the correct list (the contents of the record's cache's alt-names slot, with the name-string added) but the cache's actual slot value is not altered. It wouldn't kill me to duplicate some code and use `ebdb-add-to-list' in the function position, but I'd like to know why this doesn't work. Thanks! Eric