unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Bruce Korb <bkorb@gnu.org>
To: Andy Wingo <wingo@pobox.com>
Cc: bug-guile@gnu.org, bug-autogen@gnu.org,
	Elias Pipping <pipping@lavabit.com>
Subject: Re: [Bug-autogen] test failure with guile-2.0.2
Date: Wed, 13 Jul 2011 08:11:23 -0700	[thread overview]
Message-ID: <4E1DB59B.9070700__16164.8991903805$1310576837$gmane$org@gnu.org> (raw)
In-Reply-To: <87oc0yb8mh.fsf@pobox.com>

On 07/13/11 06:41, Andy Wingo wrote:
> No need to shout, thank you.  I agree with you.  However in this case we
> are covered: the new interface name is libguile-2.0.so.

Sorry.  It's hard to get nuanced vocal inflections encoded into text.
Too much emphasis, I guess.

> You happened to run into this issue because of a change in how
> scm_{from,to}_locale_string determines what the locale encoding is.  But
> you could have run into it in one of many other ways.
>
> In fact, for Guile 2.0, the interface changed to *match* the name.

Well, yes, but for source distributions, it gets compiled and linked
against whatever the current platform's default Guile happens to be.
You are covered only for built binary executables, not stuff that gets
recompiled expecting the old behavior.  That is why the API name
ought to change.  I wrote code based on being told that the old char
interface is now obsolete (the SCM_CHARS stuff).  The new spelling is
scm_*_locale_string().  I didn't particularly care for "locale" being
in the name, but there was no alternative.  And now these new functions
have changed their semantics to match their names better.  One can
argue that it is better, but the truth is that if the semantics change,
then it is a new interface and a changed interface ought to have a
changed name, emphasizing that it is not the same function anymore.

>> I want byte array functions where Guile isn't thinking that it knows
>> better than I do what bit values ought to be in each byte.
>
> Use a bytevector, then.  A string is logically an array of characters,
> not bytes.
>
> I realize that this is irritating to you, but it is the right thing,

I beg to differ.  It is not the right thing.  It is certainly more
consistent (behavior and name), but, repeating myself yet again,
different behavior is a different function and needs a different name.
Even though you really like the name.  New name, please.

> improves the situation for loads of users, and is largely compatible.

"almost" and "largely" and "nearly" are some of my favorite adjectives
to use about software development.

> But if what you really want is to continue using strings as bytevectors,
> you will have to make a small #define, and then be on your way.

This is shorter now that I am not fretting over Guile 1.4.x:

#if   GUILE_VERSION < 107000
# define AG_SCM_BOOL_P(_b)            SCM_BOOLP(_b)
# define AG_SCM_CHAR(_c)              gh_scm2char(_c)
# define AG_SCM_CHARS(_s)             SCM_CHARS(_s)
# define AG_SCM_FALSEP(_r)            SCM_FALSEP(_r)
# define AG_SCM_FROM_LONG(_l)         gh_long2scm(_l)
# define AG_SCM_INT2SCM(_i)           gh_int2scm(_i)
# define AG_SCM_IS_PROC(_p)           SCM_NFALSEP( scm_procedure_p(_p))
# define AG_SCM_LIST_P(_l)            SCM_NFALSEP( scm_list_p(_l))
# define AG_SCM_LISTOFNULL()          scm_listofnull
# define AG_SCM_LONG2SCM(_i)          gh_long2scm(_i)
# define AG_SCM_NFALSEP(_r)           SCM_NFALSEP(_r)
# define AG_SCM_NULLP(_m)             SCM_NULLP(_m)
# define AG_SCM_NUM_P(_n)             SCM_NUMBERP(_n)
# define AG_SCM_PAIR_P(_p)            SCM_NFALSEP( scm_pair_p(_p))
# define AG_SCM_STR02SCM(_s)          scm_makfrom0str(_s)
# define AG_SCM_STR2SCM(_st,_sz)      scm_mem2string(_st,_sz)
# define AG_SCM_STRING_P(_s)          SCM_STRINGP(_s)
# define AG_SCM_STRLEN(_s)            SCM_STRING_LENGTH(_s)
# define AG_SCM_SYM_P(_s)             SCM_SYMBOLP(_s)
# define AG_SCM_TO_INT(_i)            gh_scm2int(_i)
# define AG_SCM_TO_LONG(_v)           gh_scm2long(_v)
# define AG_SCM_TO_NEWSTR(_s)         gh_scm2newstr(_s, NULL)
# define AG_SCM_TO_ULONG(_v)          gh_scm2ulong(_v)
# define AG_SCM_VEC_P(_v)             SCM_VECTORP(_v)

#elif GUILE_VERSION < 201000
# define AG_SCM_BOOL_P(_b)            scm_is_bool(_b)
# define AG_SCM_CHAR(_c)              SCM_CHAR(_c)
# define AG_SCM_CHARS(_s)             scm_i_string_chars(_s)
# define AG_SCM_FALSEP(_r)            scm_is_false(_r)
# define AG_SCM_FROM_LONG(_l)         scm_from_long(_l)
# define AG_SCM_INT2SCM(_i)           scm_from_int(_i)
# define AG_SCM_IS_PROC(_p)           scm_is_true( scm_procedure_p(_p))
# define AG_SCM_LIST_P(_l)            scm_is_true( scm_list_p(_l))
# define AG_SCM_LISTOFNULL()          scm_list_1(SCM_EOL)
# define AG_SCM_LONG2SCM(_i)          scm_from_long(_i)
# define AG_SCM_NFALSEP(_r)           scm_is_true(_r)
# define AG_SCM_NULLP(_m)             scm_is_null(_m)
# define AG_SCM_NUM_P(_n)             scm_is_number(_n)
# define AG_SCM_PAIR_P(_p)            scm_is_true( scm_pair_p(_p))
# define AG_SCM_STR02SCM(_s)          scm_from_locale_string(_s)
# define AG_SCM_STR2SCM(_st,_sz)      scm_from_locale_stringn(_st,_sz)
# define AG_SCM_STRING_P(_s)          scm_is_string(_s)
# define AG_SCM_STRLEN(_s)            scm_c_string_length(_s)
# define AG_SCM_SYM_P(_s)             scm_is_symbol(_s)
# define AG_SCM_TO_INT(_i)            scm_to_int(_i)
# define AG_SCM_TO_LONG(_v)           scm_to_long(_v)
# define AG_SCM_TO_NEWSTR(_s)         scm_to_locale_string(_s)
# define AG_SCM_TO_ULONG(_v)          scm_to_ulong(_v)
# define AG_SCM_VEC_P(_v)             scm_is_vector(_v)
#else
#error unknown GUILE_VERSION
#endif

Regards, Bruce



  parent reply	other threads:[~2011-07-13 15:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110710.001131.2114114687665811411.pipping@lavabit.com>
2011-07-11 13:28 ` [Bug-autogen] test failure with guile-2.0.2 Bruce Korb
     [not found] ` <20110711.160906.808950167011716776.pipping@lavabit.com>
2011-07-11 17:32   ` Bruce Korb
     [not found] ` <4E1AFA72.2050803@gnu.org>
2011-07-13  8:48   ` Andy Wingo
2011-07-13 12:54     ` Bruce Korb
     [not found]     ` <4E1D95A0.60504@gnu.org>
2011-07-13 13:41       ` Andy Wingo
2011-07-13 15:01         ` Thien-Thi Nguyen
2011-07-15 16:25           ` Thien-Thi Nguyen
2011-07-18  9:30             ` Andy Wingo
2011-07-13 15:11         ` Bruce Korb [this message]
     [not found]         ` <4E1DB59B.9070700@gnu.org>
2011-07-14  9:01           ` Andy Wingo
2011-07-17 20:47             ` ‘scm_from_locale_string’ and locale character encoding Ludovic Courtès
2011-07-18 16:18               ` Bruce Korb
     [not found]               ` <4E245CC5.4040505@gnu.org>
2011-07-19  9:35                 ` Ludovic Courtès

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='4E1DB59B.9070700__16164.8991903805$1310576837$gmane$org@gnu.org' \
    --to=bkorb@gnu.org \
    --cc=bug-autogen@gnu.org \
    --cc=bug-guile@gnu.org \
    --cc=pipping@lavabit.com \
    --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).