all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Why is FUNC in cl-callf not allowed to be an expression?
@ 2019-05-09 21:52 Michael Heerdegen
  2019-05-10  0:47 ` Stefan Monnier
  0 siblings, 1 reply; 39+ messages in thread
From: Michael Heerdegen @ 2019-05-09 21:52 UTC (permalink / raw)
  To: Emacs Development

Hello,

I wonder why the FUNC argument in cl-callf is restricted to symbols (and
lambda expressions, though this is not documented).  I don't see any
reason to disallow arbitrary expressions, besides, maybe, that symbols
would become ambiguous.

I really would like to have an gv-callf that would simply interpret the
function argument as an expression.  cl-callf just saves the programmer
from typing the #' but forbids many use cases.

I think I would even like it most like this:

(defmacro gv-callf (call &optional n)
  (gv-letplace (_getter setter) (nth (or n 1) call)
    (funcall setter call)))

Example:

(let ((l (list 1 2)))
  (gv-callf (append l (list 3 4)))
  l)

=> (1 2 3 4)

(let ((l (list (list 'c 'd))))
  (gv-callf (append (list 'a 'b) (car l) (list 'e 'f)) 2)
  l)

=> ((a b c d e f))

That's simpler than current cl-callf, unites cl-callf and cl-callf2 in
something more general, and even eldoc still works in the CALL.


Michael.



^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2019-05-29 17:02 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-09 21:52 Why is FUNC in cl-callf not allowed to be an expression? Michael Heerdegen
2019-05-10  0:47 ` Stefan Monnier
2019-05-10 11:32   ` Michael Heerdegen
2019-05-10 13:28     ` Stefan Monnier
2019-05-10 14:19       ` Stefan Monnier
2019-05-10 14:22         ` Stefan Monnier
2019-05-10 15:18           ` Michael Heerdegen
2019-05-13 16:47             ` Stefan Monnier
2019-05-14 12:36               ` Michael Heerdegen
2019-05-14 23:32               ` Michael Heerdegen
2019-05-15  2:02                 ` Stefan Monnier
2019-05-15 16:38                   ` Michael Heerdegen
2019-05-15 17:19                     ` Michael Heerdegen
2019-05-16  2:18                       ` Michael Heerdegen
2019-05-16 13:12                     ` Stefan Monnier
2019-05-16 14:37                       ` Michael Heerdegen
2019-05-16 15:09                         ` Michael Heerdegen
2019-05-16 19:34                           ` Stefan Monnier
2019-05-16 21:46                             ` Michael Heerdegen
2019-05-16 23:06                               ` Stefan Monnier
2019-05-17 22:53                                 ` Michael Heerdegen
2019-05-18 14:09                                   ` Stefan Monnier
2019-05-20 23:25                                     ` Michael Heerdegen
2019-05-21  2:01                                       ` Stefan Monnier
2019-05-21  2:47                                         ` Michael Heerdegen
2019-05-21 10:16                                           ` Noam Postavsky
2019-05-21 16:38                                             ` Michael Heerdegen
2019-05-21 17:38                                           ` Stefan Monnier
2019-05-21  7:26                                         ` Andy Moreton
2019-05-23 23:02                                           ` Michael Heerdegen
2019-05-22  1:00                                     ` Michael Heerdegen
2019-05-23  1:50                                       ` Michael Heerdegen
2019-05-23  3:38                                         ` Stefan Monnier
2019-05-23 23:38                                           ` Michael Heerdegen
2019-05-24 15:29                                             ` Stefan Monnier
2019-05-28 19:54                                               ` Michael Heerdegen
2019-05-27  0:20                                     ` Michael Heerdegen
2019-05-29 17:02                                       ` Stefan Monnier
2019-05-15 19:17                   ` Michael Heerdegen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.