unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Alexei Matveev <alexei.matveev@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: Re: Guile API for foreign languages: proposing SCM scm_list_0(void)
Date: Thu, 31 Jan 2013 15:13:48 +0100	[thread overview]
Message-ID: <CACMrLAfPcHnK9tdNwPDTzr_goVjDOkvvj0Z4TcoVuKwa-+sJZA@mail.gmail.com> (raw)
In-Reply-To: <87sj5htw2h.fsf@pobox.com>

>    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;

I see it is not common to export constants to libguile,
here a complete list of read-only symbols in the version 1.8:

$ nm /usr/lib/libguile.a  | grep " R "
00000040 R scm_charnames
00000000 R scm_charnums
00000060 R scm_s_bindings
0000006d R scm_s_body
0000003c R scm_s_clauses
0000007f R scm_s_expression
00000030 R scm_s_formals
00000076 R scm_s_test
00000053 R scm_s_variable

There must be a practical reason for it.
This could be the same reason which made me come up
with a function that returns dearly missing SCM_EOL
and not a global variable for use in a Fortran project.

For comparison the text section exports 2K functions:

$ nm /usr/lib/libguile.a  | grep " T " | wc
   2152    6456   63620

Compile-time constants are cumbersome.
In C there is only #define and every other language handles
them slightly differently, yet other do not have a "compilation phase"
at all. It is hopeless to come up with a language-agnostic solution for
the compile-time constants. This optimization should be ideed left to
the language. However, if Guile API declares them to compile time
constants and this work will need to be done once for every API
version.

Alexei



  parent reply	other threads:[~2013-01-31 14:13 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
2013-01-31 14:13         ` Alexei Matveev [this message]
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=CACMrLAfPcHnK9tdNwPDTzr_goVjDOkvvj0Z4TcoVuKwa-+sJZA@mail.gmail.com \
    --to=alexei.matveev@gmail.com \
    --cc=guile-devel@gnu.org \
    /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).