bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#69739: 30.0.50; `type-of` is not precise enough


From: Stefan Monnier
Subject: bug#69739: 30.0.50; `type-of` is not precise enough
Date: Mon, 18 Mar 2024 09:33:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

>> +@example
>> +(object-type 1)
>> +     @result{} fixnum
>> +@group
>> +(object-type 'nil)
>> +     @result{} null
>> +(object-type (record 'foo))
>> +     @result{} foo
>
> "object-type"?

Oops!  thanks.

>>  DEFUN ("type-of", Ftype_of, Stype_of, 1, 1, 0,
>>         doc: /* Return a symbol representing the type of OBJECT.
>>  The symbol returned names the object's basic type;
>> -for example, (type-of 1) returns `integer'.  */)
>> +for example, (type-of 1) returns `integer'.
>> +Contrary to `cl-type-of' the returned type is not always the most
>                           ^^
> I think we want a comma there.
>> +DEFUN ("cl-type-of", Fcl_type_of, Scl_type_of, 1, 1, 0,
>> +       doc: /* Return a symbol representing the type of OBJECT.
>> +The symbol returned names the most specific possible type of the object.
>    ^^^^^^^^^^^^^^^^^^^
> I think "The returned symbol" is better here, as it prevents a
> possible confusion (whether "returned" alludes to "symbol" or to
> "names").

Agreed.

>> +for example, (object-type nil) returns `null'.
>                  ^^^^^^^^^^^
> "object-type"?

As you can see I had used `object-type` instead of `cl-type-of` in some
prior version of the code :-)

>>  (defsubst subr-primitive-p (object)
>> -  "Return t if OBJECT is a built-in primitive function."
>> +  "Return t if OBJECT is a built-in primitive written in C."
>>    (declare (side-effect-free error-free))
>>    (and (subrp object)
>>         (not (subr-native-elisp-p object))))
>>  
>> +(defsubst primitive-function-p (object)
>> +  "Return t if OBJECT is a built-in primitive function."
>> +  (declare (side-effect-free error-free))
>> +  (and (subrp object)
>> +       (not (or (subr-native-elisp-p object)
>> +                (eq (cdr (subr-arity object)) 'unevalled)))))
>
> Should these doc strings mention the special case of special form,
> which each one of them treats differently?

OK.

Pushed, thanks,


        Stefan






reply via email to

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