[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using funcall on inline functions
From: |
Eric Abrahamsen |
Subject: |
Using funcall on inline functions |
Date: |
Sat, 12 Dec 2020 14:49:28 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
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 <some-record>)
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
- Using funcall on inline functions,
Eric Abrahamsen <=