emacs-devel
[Top][All Lists]
Advanced

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

Unused value of error-free function warning (was: Predicate for true lis


From: Basil L. Contovounesios
Subject: Unused value of error-free function warning (was: Predicate for true lists)
Date: Tue, 09 Apr 2019 21:08:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> --- a/src/fns.c
>> +++ b/src/fns.c
>> @@ -5326,6 +5326,12 @@ syms_of_fns (void)
>>    DEFSYM (Qcursor_in_echo_area, "cursor-in-echo-area");
>>    DEFSYM (Qwidget_type, "widget-type");
>>  
>> +  DEFSYM (Qpure, "pure");
>> +  DEFSYM (Qside_effect_free, "side-effect-free");
>> +  DEFSYM (Qproper_list_p, "proper-list-p");
>> +  Fput (Qproper_list_p, Qpure, Qt);
>> +  Fput (Qproper_list_p, Qside_effect_free, Qt);
>
> I think you can set the side-effect-free property to `error-free`, which
> is stronger.

If error-free functions are even more restricted than other
side-effect-free ones, then why does the former class not raise a
warning in byte-optimize-form-code-walker when their return value
remains unused?  For example, compare:

  (byte-compile '(progn (list) t))
  ;; => t

with:

  (byte-compile '(progn (+) t))
  ;; => t (Warning: value returned from (+) is unused)

I understand that dead error-free expressions are just deleted, but
shouldn't the user be warned of this?  Or is that what "error-free"
stands for?

-- 
Basil



reply via email to

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