emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Distinguishing `consp` and `functionp`


From: Stefan Monnier
Subject: Re: Distinguishing `consp` and `functionp`
Date: Sat, 27 Jan 2024 09:41:48 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> I'm fine with it, on the condition that it continues to be possible to
> print and read lambdas created by quoted function forms, as:
>
>   #'(lambda () foo)

The print format will be a sticking point, I expect.

Currently on `master` it typically does not look like what you show
above but like:

    (closure ENV (x y) (message "%S" x) (+ x y))
or
    (closure ENV (x y) DOCSTRING (interactive IFORM) (message "%S" x) (+ x y))

For `prin1` with my PoC it currently looks like:

    #[(x y) ((message "%S" x) (+ x y)) ENV]
or
    #[(x y) ((message "%S" x) (+ x y)) ENV nil DOCSTRING IFORM]

and I'd rather not try to be too clever about it (it should be fairly
rare to use `prin1` on such things).  For `cl-print` we (and users) can
choose, and I currently print it as

    #f(interpreted-function ARGS BODYHASH)

because I basically kept the same code as used for compiled functions
(obeying the same `cl-print-compiled` var) but we could make it look
more "normal", like:

    #f(lambda (x y) (message "%S" x) (+ x y))

[ or #f(λ (x y) (message "%S" x) (+ x y)) 🙂 ]

> Needless to say, funcall should continue to accept old list lambdas,
> whether functionp regards them as such or not.

No disagreement here.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]