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

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

Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql'


From: Emanuel Berg
Subject: Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql'
Date: Fri, 30 Dec 2022 23:27:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Drew Adams wrote:

>>> `cl-pushnew' should be an emulation of Common Lisp
>>> `pushnew' - neither more nor less.
>>>
>>> I'm not sure what your point is, but `pushnew' defaults to
>>> using `eql', not `equal' (or `string='). So if you want
>>> `pushnew' to compare strings then yes, you should pass
>>> a predicate such as `string=' (or `equal').
>> 
>> It's much better if the function itself checks what type
>> the value is of and pick a suitable function to compare
>> from that, then the user don't have to think about that
>> at all.
>
> Again, `cl-case` came from CL `case' (and that came from
> other Lisps).

Yes, but I say that with respect to that particular function,
if it isn't to be modified for whatever external reasons
that's another discussion you of course are free to carry on
with ...

> Checking the "type the value is of" is problematic. For one
> thing, you might well want to control the type

The function, rather than you, can do this - and pretty
easily so:

(when (stringp arg)
  (setq pred #'string=) )

> And some values are of multiple types. E.g., nil's a symbol
> and a list. And some types are subtypes of other types. E.g.
> lists are sequences.

All types that are comparable have a function to do that, that
function is the one to be used.

If they haven't, how are we to determine if they are "new" at
all?

Types whose values cannot be compared even to themself to
determine equality - if such types exist - I don't see how
they can be supported by a 'pushnew' function, really?

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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