Re: Libguile and closures

Joe Keane (jgk@jgk.org)
Fri, 6 Sep 1996 16:05:38 -0700

>From experience, i've found that it's generally good practice to specify
an extra `rock' argument whenever you have a function pointer. There
are many cases where you can profitably share code, and of course you
can't dynamically create C functions, at least in any portable way.

However, RMS has a good point that the subrs really just wrap up C
functions, so it's not clear that this makes sense, and things should
not be less efficient or convenient when the argument is not needed.

I wonder if there's some advantage to making a second kind of subr that
holds an extra argument and prepends it before calling the C function.
Of course, this adds no new expressive power, because it's basically
just a lambda expression.

It's a good question what sort of support for this would be desirable in
compilers and interpreters. Perhaps the lambda expression would be
implemented efficiently enough that there's no performance advantage.
Even if that's true, it may be helpful to humans to do something special
so that they look like primitives rather than some lambda expression.