[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Why is FUNC in cl-callf not allowed to be an expression?
From: |
Michael Heerdegen |
Subject: |
Why is FUNC in cl-callf not allowed to be an expression? |
Date: |
Thu, 09 May 2019 23:52:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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.
- Why is FUNC in cl-callf not allowed to be an expression?,
Michael Heerdegen <=
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/09
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/10
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/10
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/10
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/10
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/10
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/13
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/14
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/14
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/14