GNU bug report logs -
#69739
30.0.50; `type-of` is not precise enough
Previous Next
Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date: Mon, 11 Mar 2024 23:22:01 UTC
Severity: normal
Found in version 30.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #67 received at 69739-done <at> debbugs.gnu.org (full text, mbox):
>> +@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
This bug report was last modified 1 year and 121 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.