[alexandria-devel] ensure-functionf
Knut Olav Bøhmer
bohmer at gmail.com
Mon Nov 17 11:08:58 UTC 2008
2008/11/17 Kevin Reid <kpreid at mac.com>:
> 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.
Agree.
ensure-generic-function creates a generic function.
ensure-directory-exist creates a directory if it does not exsist
ensure-class, is used to define or redefine a class.
"ensure-function" is best defined like this:
(defun coerce-function (sym)
(coerce sym 'function))
> "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/>
>
>
>
> _______________________________________________
> alexandria-devel mailing list
> alexandria-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/alexandria-devel
>
--
Knut Olav Bøhmer
More information about the alexandria-devel
mailing list