GNU bug report logs - #69739
30.0.50; `type-of` is not precise enough

Previous Next

Package: emacs;

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 #53 received at 69739 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Basil L. Contovounesios" <basil <at> contovou.net>,
 Andrea Corallo <acorallo <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 69739 <at> debbugs.gnu.org
Subject: Re: bug#69739: 30.0.50; `type-of` is not precise enough
Date: Fri, 15 Mar 2024 10:09:11 -0400
Basil L. Contovounesios [2024-03-15 10:51:33] wrote:
> No objections here, just one question: did you consider extending
> type-of with an optional argument instead of introducing cl-type-of?
> Or would that be too messy?

I did.  I decided to introduce a new function for the following reasons:

- The main use for the new function is in the dispatch code of
  `cl-generic` where it's on the critical path, so one less argument is
  better than one more argument.  Not sure how much impact it would
  really have, tho, so it's not a very strong argument.
- I don't know of a good reason to prefer the `type-of` behavior other
  than backward compatibility, and requiring a non-nil arg to get the
  "good" behavior would make it difficult to get rid of the
  legacy behavior.


Andrea Corallo [2024-03-15 06:54:36] wrote:
> FWIW: I think this is a good change and agree `cl-type-of` is a good
> name for the new function.  I'm just wondering if we should have some
> test to cover this.

Are you suggesting that my code can be anything else than perfect?
More seriously, I couldn't think of a good test, but I'll try harder.

Eli Zaretskii [2024-03-15 13:50:56] wrote:
> Should we document this new function in the ELisp manual?

I was thinking that we should do that only when/if we demote `type-of`
(`(cl-)type-of` is an operation that's used very rarely, so I think it's
best to keep it to a minimum in the manual),
Of course, the name also begs the question whether it should be in the
ELisp manual or in the CL manual.

In a previous version of the patch I had it documented alongside
`type-of`, so I can easily dig that up if you think it's best.


        Stefan





This bug report was last modified 1 year and 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.