This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Names in libguile


Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:

> There are a lot of macros for predicates, which are either named SCM_XXXP
> or SCM_XXX_P.  Unfortunately (IMO) lots of the more frequently used macros
> are named SCM_XXXP, while I think the SCM_XXX_P variant is better:  For me
> it is better readable, it matches the scm_xxx_p naming scheme, and doesn't
> make constructs like SCM_GRPP (I made this up, just to show the idea) or
> other strange things necessary if there is some XXX which already ends
> with P.

I think we've used the convention for predicates specified in CLTL2:

A predicate is testing a certain concept.  If the part of the name
denoting that concept is a single word, we put no _ before P, if it is
multiple words, we use _ :

  SCM_KEYWORDP
  SCM_IS_A_P

I personally find this nice because it's easier to write SCM_KEYWORDP
than SCM_KEYWORD_P and I actually find it more readable (because it's
easier for the brain to group it).

> Further, I'd love it if macros to create scheme values from C values would
> be named SCM_MAKE_... more consitently.  Currently, we have SCM_MAKICHAR
> (OK, this one's been made deprecated), SCM_MAKINUM and others.

I agree.

> Also, some macros are used for symbols or keywords.  The best solution
> would be to use a similar naming scheme for these also.
> 
> It's good to talk about improving guile's API.  A clean, consistent and
> beautiful api is, in my belief, important for guile's attractivity, and
> makes learning it easier.  

Yes!

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]