[alexandria-devel] ensure-functionf

Nikodemus Siivola nikodemus at random-state.net
Sun Nov 23 09:33:16 UTC 2008


On Mon, Nov 17, 2008 at 1:46 PM, Attila Lendvai
<attila.lendvai at gmail.com> wrote:
>> I did not understand how you plan to use this macro. Maybe there is a
>> reason you made it a macro, and not a function.
>> Can you explain?
>
> the typical use-case is a mapping function that accepts various
> function designators like &key (test 'eq) (key 'identity).
>
> if it loops a lot and it's supposed to run fast, then one should look
> up the functions before looping:
>
> (ensure-functionf test key)
> (do-the-looping)
>
> i'm open for suggestions for different naming, but i don't think that
> the cl spec is so much more important than the english language and
> the meaning of the "ensure" word. also, if you look at it from a
> different POV, the primary feature of e.g. ENSURE-SYMBOL is to return
> a symbol designated by its argument, and it's secondary that it may
> need to do some sideffects to achieve that. also note that there are
> already ENSURE-LIST, ENSURE-CONS, etc that do not have any sideffects.

I see Kevin's concern, though I think that "ENSURE" functions are the
sort with "allowed accidental side-effects", whereas the important
thing is that certain things hold true about the return value.

I am personally ok with ENSURE- naming as it stands, but if there is a
concern about diluting an existing naming convention, and a better
name comes up -- I can live with the change as well.

> although i would be happy if we could settle on acceptable names,
> because otherwise these oneliners will end up in my duplicates.lisp
> files all around in different projects.

Well, maybe we need to open Babylon. :) (A subproject which collects
things which might be in Alexandria, but for one reason or another
aren't -- too controversial, too different, not sufficiently
commonplace, etc.)

Re. CALLF: I'll think about it properly sometime during next week. (I
am torn about it: half the time I can't remember why I like it, and
half the time I can't remember why I *don't* like it.)

Cheers,

 -- Nikodemus




More information about the alexandria-devel mailing list