[alexandria-devel] ensure-functionf

Kevin Reid kpreid at mac.com
Mon Nov 17 02:26:02 UTC 2008


On Nov 16, 2008, at 7:52, Attila Lendvai wrote:

> dear list,
>
> i've got this patch pending:
>
> (defmacro ensure-functionf (&rest places)
>  "Call ENSURE-FUNCTION for each place in PLACES and store back the  
> results."
>  `(progn
>     ,@(mapcar (lambda (place)
>                 `(setf ,place (ensure-function ,place)))
>               places)))
>
> it might be controversial, so i'll first send it here. if noone
> complains for a week or two, then i'll push it eventually.

For what little it's worth: I think this and ENSURE-FUNCTION are abuse  
of the naming conventions employed by the CL specification.

"ensure" is a mutating concept: see cl:ensure-generic-function,  
cl:ensure-directories-exist. These potentially mutate a function slot  
and the filesystem, respectively. (alexandria:ensure-symbol is an  
example of correct usage.)

That is, this proposed operator should be called ENSURE-FUNCTION and  
the current ENSURE-FUNCTION should be called something else. (Perhaps  
ACTUALLY-FUNCTION or AS-FUNCTION or some sort of name expressing de- 
indirection?)

Also, I think "f" doesn't mean "in-place version of other operator",  
but only "operates on a place"; e.g. PUSH is not CONSF, INCF is not  
1+F, and SETF is not, uh, NTH-VALUES-2F? The CLHS examples for DEFINE- 
MODIFY-MACRO arguably disagree with me, though. I don't feel this is  
nearly as important as preserving what ENSURE means.

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>






More information about the alexandria-devel mailing list