bug-guile
[Top][All Lists]
Advanced

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

Re: [Bug-autogen] test failure with guile-2.0.2


From: Bruce Korb
Subject: Re: [Bug-autogen] test failure with guile-2.0.2
Date: Wed, 13 Jul 2011 08:11:23 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11

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



reply via email to

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