[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Couple things...



Michael Sperber <sperber@xxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:

> A strong reason to prefer C macros over functions in this kind of
> settings is that functions live in a global namespace, while the
> macros (can) live in a local one.  In principle, macros allows, say,
> hooking up two Scheme systems, while functions wouldn't.

If this is your best reason, it's very weak.  Using macros only makes
it possible if the two Schemes agree about what global names to
avoid.  If they agree to cooperate, then a shared global name function
can still be used.  At best, macros make it *simpler* to agree, but
hardly guarantee it.  Moreover, if you need to rename functions in one
scheme or the other, to avoid a collision, where the FFI uses only
macros, you still might have a disaster.  Renaming functions is
generally not a simple matter.

Moreover, your advantage is only realized if the schemes are
*required* to use macros, instead of merely permitted, and even then,
many will choose to implement lots of things by straightforward
functions.  

And finally, there are C systems which enable such functions to be in
a local namespace.  

Thomas