From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: When to use SCM_DEFINE vs SCM_GPROC vs SCM_PRIMITIVE_GENERIC? Date: Fri, 28 Jan 2011 15:37:38 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1296225174 12002 80.91.229.12 (28 Jan 2011 14:32:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 28 Jan 2011 14:32:54 +0000 (UTC) Cc: guile-devel@gnu.org To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jan 28 15:32:48 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PipNX-0004Mj-Di for guile-devel@m.gmane.org; Fri, 28 Jan 2011 15:32:47 +0100 Original-Received: from localhost ([127.0.0.1]:53491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PipNW-0002G6-Sq for guile-devel@m.gmane.org; Fri, 28 Jan 2011 09:32:46 -0500 Original-Received: from [140.186.70.92] (port=51973 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PipNU-0002Di-6o for guile-devel@gnu.org; Fri, 28 Jan 2011 09:32:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PipNS-0008Gw-Uy for guile-devel@gnu.org; Fri, 28 Jan 2011 09:32:44 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:54057 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PipNS-0008Gq-SY for guile-devel@gnu.org; Fri, 28 Jan 2011 09:32:42 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 8599D3288; Fri, 28 Jan 2011 09:33:32 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=WGEte/RMLTfhHWIA9SGbI1pZjtw=; b=G7v5uW 8JnvpQxzkQLmEFZL6/NAHOvj6TmKuBHLyjE7Leo0OqV4UH9ykmDFlMy7bKOBsMvf NerUVbRhCDcUO4JQMfMKheTRe/N6dQU2G37/GZkruj8If4jnAwIGBxSEidarkdFh nQ7SINBEZzPWxD4wXSTWAlbH0gXzUJSGbNTBA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=CTEgy2ycT/SHTV6MqhUQY/BAAf8S2dzC 4KQ01ye/SGz3lr1TK1BcXkNBHVw6IxUiZWV82nsb6VwzsznEWWMLOUOaUiolAMne qeRmm5UwLMy12LmkZROgBZJ34Xud4jAfLrmQG8wojJBsNAUiQZS1NHK6WhcHsp2S 0dTN+rSxK2s= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 6A0B63287; Fri, 28 Jan 2011 09:33:31 -0500 (EST) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id B804F3286; Fri, 28 Jan 2011 09:33:29 -0500 (EST) In-Reply-To: (Mark H. Weaver's message of "Thu, 27 Jan 2011 19:47:28 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 943DD8B2-2AEB-11E0-91DA-BC4EF3E828EC-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11381 Archived-At: Hi Mark, On Fri 28 Jan 2011 01:47, Mark H Weaver 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/