unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Noah Lavine <noah.b.lavine@gmail.com>
To: Andy Wingo <wingo@pobox.com>
Cc: guile-devel <guile-devel@gnu.org>,
	Alexei Matveev <alexei.matveev@gmail.com>
Subject: Re: Guile API for foreign languages: proposing SCM scm_list_0(void)
Date: Thu, 31 Jan 2013 08:37:46 -0500	[thread overview]
Message-ID: <CA+U71=MECRg=VOBUOuY4zaivkOM_Fs7n7VfqNKhs-iBtyLjziA@mail.gmail.com> (raw)
In-Reply-To: <87sj5htw2h.fsf@pobox.com>

[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]

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 <wingo@pobox.com> wrote:

> On Thu 31 Jan 2013 12:27, Andy Wingo <wingo@pobox.com> writes:
>
> > On Tue 22 Jan 2013 11:55, Andy Wingo <wingo@pobox.com> 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/
>
>

[-- Attachment #2: Type: text/html, Size: 2572 bytes --]

  reply	other threads:[~2013-01-31 13:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-02 11:11 Guile API for foreign languages: proposing SCM scm_list_0(void) Alexei Matveev
2013-01-12 15:16 ` Andy Wingo
2013-01-14 22:44   ` Alexei Matveev
2013-01-15  9:06     ` Andy Wingo
2013-01-15  9:20       ` Ludovic Courtès
2013-01-22 10:55   ` Andy Wingo
2013-01-31 11:27     ` Andy Wingo
2013-01-31 11:45       ` Andy Wingo
2013-01-31 13:37         ` Noah Lavine [this message]
2013-01-31 14:13         ` Alexei Matveev
2013-01-31 16:57         ` Alexei Matveev
2013-01-31 17:23           ` 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='CA+U71=MECRg=VOBUOuY4zaivkOM_Fs7n7VfqNKhs-iBtyLjziA@mail.gmail.com' \
    --to=noah.b.lavine@gmail.com \
    --cc=alexei.matveev@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=wingo@pobox.com \
    /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).