[Openmcl-devel] Naming anonymous functions

Gary Byers gb at clozure.com
Sat Mar 1 20:18:54 PST 2014



On Sat, 1 Mar 2014, Gail Zacharias wrote:

> On Sat, Mar 1, 2014 at 8:07 PM, Ron Garret <ron at flownet.com> wrote:
>       >
>       > For debugging purposes, conformingly you could merely put the
>       functions
>       > in a hash-table with their "name?.
> 
> That?s actually a very good idea. ?It would have to be a weak hash
> table, and I'd need a custom print-object method for functions, but it
> would do exactly what I want. ?Thanks for the suggestion!
> 
> 
> That's pretty much what the two-argument ccl::lfun-name does.
>

And it does it in a way that PRINT-OBJECT and other things that may want
to know a function's canonical name (CL:FUNCTION-LAMBDA-EXPRESSION) can use.

There are some fairy obscure cases where the two-arg CCL::LFUN-NAME isn't
GC-safe, and I have the feeling that it would create more confusion if I were
to try to enumerate those cases than it would to remain silent.   The particular
case that Ron was asking about - where he wants to give an otherwise anomymous
function a name - should always be GC-safe.



More information about the Openmcl-devel mailing list