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,gmane.lisp.guile.user Subject: Re: Guile API for foreign languages: proposing SCM scm_list_0(void) Date: Sat, 12 Jan 2013 16:16:37 +0100 Message-ID: <87txqmwhwq.fsf@pobox.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1358003818 1196 80.91.229.3 (12 Jan 2013 15:16:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Jan 2013 15:16:58 +0000 (UTC) Cc: guile-user@gnu.org, guile-devel To: Alexei Matveev Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jan 12 16:17:15 2013 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tu2pd-0003HZ-9u for guile-devel@m.gmane.org; Sat, 12 Jan 2013 16:17:13 +0100 Original-Received: from localhost ([::1]:48921 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu2pN-00034Y-92 for guile-devel@m.gmane.org; Sat, 12 Jan 2013 10:16:57 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:53858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu2pF-000341-1G for guile-devel@gnu.org; Sat, 12 Jan 2013 10:16:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tu2p8-0005Rm-7y for guile-devel@gnu.org; Sat, 12 Jan 2013 10:16:48 -0500 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:42055 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu2p8-0005Rg-3K; Sat, 12 Jan 2013 10:16:42 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id ABC65AEB9; Sat, 12 Jan 2013 10:16:41 -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=XAFrMmchBofXhGkGOR1XHsUvXic=; b=ofn0zp CPR6PwYIj+cSCRZhW57iJv4BxFFPlb1ATHnfQO+Oh232jMWbV2/SxrYaer5QkpzO 86P+1QKiv0gn+hnik931wC8j/mLPbrZirxSuONiEqamsIkpjGJE/96raKf9J8OHe N1Kbuc3P3hxx3pz9pivSgyUOWNKImkQhgsBlc= 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=S60XW0dF5il8fxxTs2hEgaExgzD/oBao yvHXbsxq5jivvycBN8EMLw5KDG2UdcYGLfoTyz9J4/6Wf/8zeQ8SIl6gkR/0z47o wST9jJzLxAmQf+IQ5eDyVfWnndh41xXwyJzTKIHDEwOOnlVq6YpQt3kQ7uxRXN2b x4Bxt6S6dNA= Original-Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id A05D7AEB8; Sat, 12 Jan 2013 10:16:41 -0500 (EST) Original-Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 0ACC3AEB6; Sat, 12 Jan 2013 10:16:40 -0500 (EST) In-Reply-To: (Alexei Matveev's message of "Mon, 2 Jul 2012 13:11:14 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Pobox-Relay-ID: 113AEEC8-5CCB-11E2-B814-0A4F0E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 208.72.237.25 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:15403 gmane.lisp.guile.user:9846 Archived-At: Hi Alexei, On Mon 02 Jul 2012 13:11, Alexei Matveev writes: > To raise this question again: I ended up with a wrapper > function for a Fortran project equivalent to the scm_list_0() > quoted below. The reason is accessing macros from languages > other than C is cumbersome. > > Contrary to scm_from/to_int, scm_is_* and other macros > adding this as a funciton one is a no-brainer, since it would > be a new API call and raises no compatibility concerns. Apologies for ignoring you. I think that the thought that if we wanted to follow through the logic of making Guile's C API available to non-C languages, we should do so either all the way or not at all. Each additional function added to Guile's ABI imposes additional cost in runtime memory, ELF symbol resolution, and (to a degree) startup time, without providing any benefits to C users. On the other hand, if we are only talking about 2 functions (say), then clearly we should do it. So part of the question is, how much work are we talking about? I grepped the header files for lines starting with "#define SCM_", munged out the name of the macro and sorted them for uniqueness. That was around 1200 macros. I filtered out certain kinds of macros: * those ending in _H (header guards) * those starting with SCM_I_ (internal macros) * those containing _BIT (implementation details) * SCM_VALIDATE_ macros (there are corresponding C procedures) That left me with about 900 macros. I then filtered out all macros that had a corresponding C binding. For example, SCM_CAR has a C procedure, `scm_car'. That left me with about 780 macros. Finally, from this list, I filtered out those symbols that did not appear in our documentation. That resulted in the following 77 symbols: SCM_ALLOW_INTS SCM_ARG1 SCM_ARG2 SCM_ARG3 SCM_ARG4 SCM_ARG5 SCM_ARG6 SCM_ARG7 SCM_ARGn SCM_ASSERT_TYPE SCM_BOOL_F SCM_BOOL_T SCM_BYTEVECTOR_CONTENTS SCM_CELL_OBJECT SCM_CELL_OBJECT_0 SCM_CELL_OBJECT_1 SCM_CELL_TYPE SCM_CELL_WORD SCM_CELL_WORD_0 SCM_CELL_WORD_1 SCM_DEFER_INTS SCM_ELISP_NIL SCM_EOF_VAL SCM_EOL SCM_FRAME_DATA_ADDRESS SCM_FRAME_LOWER_ADDRESS SCM_FRAME_UPPER_ADDRESS SCM_GLOBAL_KEYWORD SCM_GLOBAL_VARIABLE SCM_GLOBAL_VARIABLE_INIT SCM_GPROC SCM_HOOKP SCM_IMP SCM_NEWSMOB SCM_NEWSMOB2 SCM_NEWSMOB3 SCM_PTAB_ENTRY SCM_PTOBNUM SCM_REGISTER_PROC SCM_RETURN_NEWSMOB SCM_RETURN_NEWSMOB2 SCM_RETURN_NEWSMOB3 SCM_SET_CELL_OBJECT SCM_SET_CELL_OBJECT_0 SCM_SET_CELL_OBJECT_1 SCM_SET_CELL_TYPE SCM_SET_CELL_WORD SCM_SET_CELL_WORD_0 SCM_SET_CELL_WORD_1 SCM_SET_SMOB_DATA SCM_SET_SMOB_DATA_2 SCM_SET_SMOB_DATA_3 SCM_SET_SMOB_FLAGS SCM_SET_SMOB_OBJECT SCM_SET_SMOB_OBJECT_2 SCM_SET_SMOB_OBJECT_3 SCM_SIMPLE_VECTOR_LENGTH SCM_SIMPLE_VECTOR_REF SCM_SIMPLE_VECTOR_SET SCM_SMOB_DATA SCM_SMOB_DATA_2 SCM_SMOB_DATA_3 SCM_SMOB_FLAGS SCM_SMOB_OBJECT SCM_SMOB_OBJECT_2 SCM_SMOB_OBJECT_2_LOC SCM_SMOB_OBJECT_3 SCM_SMOB_OBJECT_3_LOC SCM_SMOB_OBJECT_LOC SCM_SMOB_PREDICATE SCM_TICK SCM_UNBNDP SCM_UNBOUND SCM_UNDEFINED SCM_UNSPECIFIED SCM_VARIABLE_INIT The next step would be to manually check which of these symbols are actually necessary. Perhaps I can leave this job to someone else :) Regards, Andy -- http://wingolog.org/