guile-devel
[Top][All Lists]
Advanced

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

When to use SCM_DEFINE vs SCM_GPROC vs SCM_PRIMITIVE_GENERIC?


From: Mark H Weaver
Subject: When to use SCM_DEFINE vs SCM_GPROC vs SCM_PRIMITIVE_GENERIC?
Date: Thu, 27 Jan 2011 19:47:28 -0500

I am writing C versions of R6RS div/mod/div0/mod0, as well as
div-and-mod and div0-and-mod0, for numbers.c.

I notice that numbers.c uses three different macros to define public
procedures: SCM_DEFINE, SCM_GPROC, and SCM_PRIMITIVE_GENERIC.  I don't
see an obvious logic to the choices of which macro to use.  For
example, `exact->inexact' uses SCM_GPROC whereas `inexact->exact' uses
SCM_DEFINE.

One obvious disadvantage to SCM_GPROC is that it doesn't accept a
documentation string.

Can someone please enlighten me about the relevant factors to decide?
What macro do you think I should use for the functions I'm writing?
Note that `div-and-mod' and `div0-and-mod0' will return two values.

One more question: do you think I should give div/mod/div0/mod0 their
short R6RS names by default?

    Thanks,
      Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]