[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why is FUNC in cl-callf not allowed to be an expression?
From: |
Stefan Monnier |
Subject: |
Re: Why is FUNC in cl-callf not allowed to be an expression? |
Date: |
Thu, 09 May 2019 20:47:48 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> 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.
`callf` has been in cl.el "for ever" but it's not in Common-Lisp, so
I don't really know where it comes from. I agree that when I moved it
to cl-lib, I missed an opportunity to fix it and make it take a normal
expression as first argument.
> 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.
FWIW, you can circumvent this with
(cl-flet ((f <EXPR>))
(cl-callf f ...))
> 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)))
It's cute, tho I'm not too fond of specifying the place via a number,
personally,
Stefan
- Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/09
- Re: Why is FUNC in cl-callf not allowed to be an expression?,
Stefan Monnier <=
- 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
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/15