unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel@gnu.org
Subject: Re: When to use SCM_DEFINE vs SCM_GPROC vs SCM_PRIMITIVE_GENERIC?
Date: Fri, 28 Jan 2011 15:37:38 +0100	[thread overview]
Message-ID: <m3aaildrgt.fsf@unquote.localdomain> (raw)
In-Reply-To: <E1PicUq-0006Em-5Q@freedomincluded> (Mark H. Weaver's message of "Thu, 27 Jan 2011 19:47:28 -0500")

Hi Mark,

On Fri 28 Jan 2011 01:47, Mark H Weaver <mhw@netris.org> 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/



  reply	other threads:[~2011-01-28 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-28  0:47 When to use SCM_DEFINE vs SCM_GPROC vs SCM_PRIMITIVE_GENERIC? Mark H Weaver
2011-01-28 14:37 ` Andy Wingo [this message]
2011-01-29 15:39   ` Mark H Weaver
2011-01-29 17:17     ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3aaildrgt.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).