emacs-devel
[Top][All Lists]
Advanced

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

Re: Can the byte-compiler check whether functions passed by name are def


From: Klaus-Dieter Bauer
Subject: Re: Can the byte-compiler check whether functions passed by name are defined?
Date: Mon, 5 Aug 2013 20:17:51 +0200

2013/8/5 Stefan Monnier <address@hidden>:
>>     (mapcar (if flag 'f1 'f2) list)
>>     => (mapcar (if flag #'f1 #'f2) list)
>
> No, I definitely don't want to get into such fanciness.
> But I do want compiler warnings if the coder writes
>
>      (mapcar (if flag #'f1 #'f2) list)
>
> and `f1' or `f2' are unknown.

My code does that and indeed that was, what I first implemented. I
then added the second check, where (quote f1) is handled for functions
known to be higher-order.

>> Shouldn't the markup for user-written functions be a bit easier?
>
> I'm not too worried about it, no.  We should instead aim to teach people
> to write #'foo instead of 'foo.

I am not sure about that... On the one hand, I see your point, since
consistently writing #'function is better for the byte compiler, as in
the (if flag #'f1 #'f2) form; If #'f1 is the standard method people
will write (if flag 'f1 'f2) and not get a warning.

On the other hand though, subjectively, #'f1 is a huge deal more
visual clutter and somewhat awkward to type (on a German keyboard at
least). Might be just a training effect, but I also feel that the
hash-quote sequence moves the attention away from the function name,
while 'f1 does not (or #f1, '#f1 for that matter, but those are not
elisp).

  - Klaus



reply via email to

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