From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.lisp.guile.devel Subject: Re: Guile API for foreign languages: proposing SCM scm_list_0(void) Date: Thu, 31 Jan 2013 08:37:46 -0500 Message-ID: References: <87txqmwhwq.fsf@pobox.com> <87y5flwkpq.fsf@pobox.com> <871ud1vbgo.fsf@pobox.com> <87sj5htw2h.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec5171f1d72c10504d495bbc9 X-Trace: ger.gmane.org 1359639909 29897 80.91.229.3 (31 Jan 2013 13:45:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Jan 2013 13:45:09 +0000 (UTC) Cc: guile-devel , Alexei Matveev To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jan 31 14:45:29 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 1U0uSG-0000D1-Ls for guile-devel@m.gmane.org; Thu, 31 Jan 2013 14:45:28 +0100 Original-Received: from localhost ([::1]:53182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0uRy-0002Eg-HN for guile-devel@m.gmane.org; Thu, 31 Jan 2013 08:45:10 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0uKu-0007Ht-Eo for guile-devel@gnu.org; Thu, 31 Jan 2013 08:37:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0uKp-0000lz-Od for guile-devel@gnu.org; Thu, 31 Jan 2013 08:37:52 -0500 Original-Received: from mail-vc0-f182.google.com ([209.85.220.182]:49007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0uKp-0000lh-HO for guile-devel@gnu.org; Thu, 31 Jan 2013 08:37:47 -0500 Original-Received: by mail-vc0-f182.google.com with SMTP id fl17so1765086vcb.27 for ; Thu, 31 Jan 2013 05:37:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=l5D1bCT25qrdetzhw3R+CSftLRVxlo2/syTZzd/pSkI=; b=OBhJ4rVr7uPGYRj+wi5Y/L/1XWiJupKDfZRLvMcyM6Y8PNlIolEbnMbnhAc6PCxEuy /UiX3aqxN0+lwbt3AItJOluWplZ2nWhRYtmD/5YcHKbqbefNlf18xQeY7IVps19HBO4F Kmoz3isi1PNoXPFAp/iEWSOZQaqDLhBiJpcDYLvHj8PWMLjXx2zEYAhNmMP/9Pn3Y//m v+kcCsIXPhEiRzJQE9ybRLoHrA9+iUJPneSen/VZxckRr1AmoHwCOBa29JEFCSxhPHce XVFRp3zEWY5qNrXIeEhvOOWPLun7RHSu3pSdqJk6AkwDhT+VG/w1odl6iYQohfwdDEvv bk3g== X-Received: by 10.52.180.202 with SMTP id dq10mr6979225vdc.129.1359639466917; Thu, 31 Jan 2013 05:37:46 -0800 (PST) Original-Received: by 10.58.171.41 with HTTP; Thu, 31 Jan 2013 05:37:46 -0800 (PST) In-Reply-To: <87sj5htw2h.fsf@pobox.com> X-Google-Sender-Auth: rf9o74FlsGKdoQhNeHRe0R1gZt4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.182 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:15648 Archived-At: --bcaec5171f1d72c10504d495bbc9 Content-Type: text/plain; charset=ISO-8859-1 I don't know much about language interfaces, but why not have these be constants exported by libguile.so? Is there any reason for other languages to have to make their own lists? Thanks, Noah On Thu, Jan 31, 2013 at 6:45 AM, Andy Wingo wrote: > On Thu 31 Jan 2013 12:27, Andy Wingo writes: > > > On Tue 22 Jan 2013 11:55, Andy Wingo writes: > > > >> SCM_BOOL_F > >> SCM_BOOL_T > >> SCM_ELISP_NIL > >> SCM_EOF_VAL > >> SCM_EOL > >> SCM_UNBOUND > >> SCM_UNDEFINED > >> SCM_UNSPECIFIED > >> > > Instead, users should just keep a table of what the values of these > > constants are for a given Guile major series. Defining them as > > enumerated values doesn't help e.g. an Ada compiler. The particular > > language should make this list in their own source code format, perhaps > > generated by a small C program linked to libguile. > > Or by Scheme: > > (for-each > (lambda (pair) > (format #t "static const scm_t_bits my_~A = 0x~X;\n" > (car pair) (object-address (cdr pair)))) > `(("false" . #f) > ("true" . #t) > ("nil" . #nil) > ("eof" . ,the-eof-object) > ("eol" . ()) > ("unspecified" . ,*unspecified*))) > > static const scm_t_bits my_false = 0x4; > static const scm_t_bits my_true = 0x404; > static const scm_t_bits my_nil = 0x104; > static const scm_t_bits my_eof = 0xa04; > static const scm_t_bits my_eol = 0x304; > static const scm_t_bits my_unspecified = 0x804; > > Unbound and undefined are a little trickier. > > Andy > -- > http://wingolog.org/ > > --bcaec5171f1d72c10504d495bbc9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I don't know much about language interfaces, but why n= ot have these be constants exported by libguile.so? Is there any reason for= other languages to have to make their own lists?

Thanks,
Noah



On Thu, Jan 31, 2013 at 6:4= 5 AM, Andy Wingo <wingo@pobox.com> wrote:
On Thu 31 Jan 2013 12:27, = Andy Wingo <wingo@pobox.com> w= rites:

> On Tue 22 Jan 2013 11:55, Andy Wingo <wingo@pobox.com> writes:
>
>> =A0 =A0 =A0SCM_BOOL_F
>> =A0 =A0 =A0SCM_BOOL_T
>> =A0 =A0 =A0SCM_ELISP_NIL
>> =A0 =A0 =A0SCM_EOF_VAL
>> =A0 =A0 =A0SCM_EOL
>> =A0 =A0 =A0SCM_UNBOUND
>> =A0 =A0 =A0SCM_UNDEFINED
>> =A0 =A0 =A0SCM_UNSPECIFIED
>>
> Instead, users should just keep a table of wha= t the values of these
> constants are for a given Guile major series. =A0Defining them as
> enumerated values doesn't help e.g. an Ada compiler. =A0The partic= ular
> language should make this list in their own source code format, perhap= s
> generated by a small C program linked to libguile.

Or by Scheme:

=A0 =A0(for-each
=A0 =A0 =A0(lambda (pair)
=A0 =A0 =A0 =A0(format #t "static const scm_t_bits my_~A =3D 0x~X;\n&q= uot;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (car pair) (object-address (cdr pair)))= )
=A0 =A0 =A0`(("false" . #f)
=A0 =A0 =A0 =A0("true" . #t)
=A0 =A0 =A0 =A0("nil" . #nil)
=A0 =A0 =A0 =A0("eof" . ,the-eof-object)
=A0 =A0 =A0 =A0("eol" . ())
=A0 =A0 =A0 =A0("unspecified" . ,*unspecified*)))

=A0 =A0static const scm_t_bits my_false =3D 0x4;
=A0 =A0static const scm_t_bits my_true =3D 0x404;
=A0 =A0static const scm_t_bits my_nil =3D 0x104;
=A0 =A0static const scm_t_bits my_eof =3D 0xa04;
=A0 =A0static const scm_t_bits my_eol =3D 0x304;
=A0 =A0static const scm_t_bits my_unspecified =3D 0x804;

Unbound and undefined are a little trickier.

Andy
--
http://wingolog.org/=


--bcaec5171f1d72c10504d495bbc9--