emacs-devel
[Top][All Lists]
Advanced

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

Re: Distinguishing `consp` and `functionp`


From: João Távora
Subject: Re: Distinguishing `consp` and `functionp`
Date: Mon, 29 Jan 2024 16:34:49 +0000

On Mon, Jan 29, 2024 at 4:28 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> > I don't think there is much space for philosophy or debate in noting
> > for example, that a list as lambda won't get byte-compiled like a
> > true lambda form.
> >
> > (byte-compile '(let ((bla (lambda () (+ 42 42))))
> >                  (funcall bla))) ;; -> (byte-code "\300\211 \207" [#[0
> > "\300\207" [84] 1]] 2)
> >
> >
> > (byte-compile '(let ((bla '(lambda () (+ 42 42))))
> >                  (funcall bla)));; -> (byte-code "\300 \207" [(lambda
> > nil (+ 42 42))] 1)
>
> While it's in the vicinity, this is not directly related to my patch.

I know, your patch doesn't address this.  But if I understand
correctly it makes at least functionp return nil for the second one.
Or at least makes way for it.  And that's a plus in my book.

>
> >>     commit 9228fd983bb9e71d44d406433a46495b22640801
> >>     Author: Marten Lienen <marten.lienen@gmail.com>
> >>     Date:   Mon Jan 22 11:08:44 2024 +0100
> >>
> >>         * yasnippel.el (yas-buffer-local-condition): Check functionp 
> >> before consp to allow closures
> [...]
> > Stefan's patch moves us in the right direction if just for the guidance
> > it gives to ignorant Lispers like the one who introduced that bug circa 
> > 2009.
>
> FWIW, the bug fixed by the above commit was introduced a few days
> earlier by yours truly,

Alright.  I wouldn't be surprised if I wasn't passing lists as lambdas
around in that extension.  I used to do that, and saw many fall prety
to this, when their lisps allow it.  The result is harder to debug code
and harder to instrument.



reply via email to

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