[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: When to use SCM_DEFINE vs SCM_GPROC vs SCM_PRIMITIVE_GENERIC?
From: |
Andy Wingo |
Subject: |
Re: When to use SCM_DEFINE vs SCM_GPROC vs SCM_PRIMITIVE_GENERIC? |
Date: |
Fri, 28 Jan 2011 15:37:38 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi Mark,
On Fri 28 Jan 2011 01:47, Mark H Weaver <address@hidden> writes:
> 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.
Yeah, I have no idea why exact->inexact would be extensible and
inexact->exact is not. (And perhaps we should deprecate those functions
in favor of the R6RS spelling, `inexact' and `exact'. Another topic.)
And I don't recall the practical difference between GPROC and
PRIMITIVE_GENERIC.
> 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.
For now, SCM_DEFINE. We can change that later to PRIMITIVE_GENERIC if
needed.
> One more question: do you think I should give div/mod/div0/mod0 their
> short R6RS names by default?
Yes, I think. At least I remember coming to that conclusion at one
point, before I had to move away from that work. We might want opcodes
for some of these, also.
Andy
--
http://wingolog.org/