[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile API for foreign languages: proposing SCM scm_list_0(void)

From: Noah Lavine
Subject: Re: Guile API for foreign languages: proposing SCM scm_list_0(void)
Date: Thu, 31 Jan 2013 08:37:46 -0500

I don't know much about language interfaces, but why not have these be constants exported by Is there any reason for other languages to have to make their own lists?


On Thu, Jan 31, 2013 at 6:45 AM, Andy Wingo <address@hidden> wrote:
On Thu 31 Jan 2013 12:27, Andy Wingo <address@hidden> writes:

> On Tue 22 Jan 2013 11:55, Andy Wingo <address@hidden> writes:
>>      SCM_BOOL_F
>>      SCM_BOOL_T
>>      SCM_EOF_VAL
>>      SCM_EOL
> 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:

     (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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]