This is the mail archive of the guile@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: SMOB tutorial for Scwm and Guile


Russ McManus <russell.mcmanus@gs.com> writes:

> > There are currently too many places where you have to have a
> > somewhat intimate knowledge of the inner workings of Guile to get
> > things right (and the lack of documentation doesn't help a bit).
> 
> Other than initializing a smob, can you think of others?  I'd like
> to document the ugly spots, and known work arounds.

There are plenty of lurking bugs in code that doesn't follow guile's
requirements (that aren't checked at all).  E.g., the argument numbers
when defining primitives needs to match the actual formals,
SCM_UNDEFINED needs to be used to terminate a gh_list(...) [not SCM_EOL, 
or SCM_UNSPECIFIED].  SCM_UNSPECIFIED needs to be returned if no other
value is returned from a primitive.  SCM boolean values are both
interpreted as true to the C compiler (ie., SCM_BOOL_F is also
nonzero).  Error checking for arguments is not enforced at all-- one can 
report an incorrect position number or wrong formal name very easily.

Lots of the above are checked for (approximately) by Scwm's
documentation extraction system.  There are also other macros in
scwm-snarf.h and scwm.h that help alleviate some of these problems.

See also:

http://vicarious-existence.mit.edu/cgi-bin/cvsweb.new/~checkout~/doc/dev/common-primitive-mistakes

and the other developer notes on the Scwm page.

http://vicarious-existence.mit.edu/scwm/

Greg B