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]

generic functions


Hi!

The code for generic functions currently generates a SCM value
SCM_PACK(0) in order to indicate, that a generic function is not
initialized yet.  This shows in the definitions of SCM_WTA_DISPATCH* in
__scm.h as well as in SCM_GPROC* in snarf.h.

For example, in the following code 'gf' is a SCM value holding a generic
function or initially a zero.

#define SCM_WTA_DISPATCH_0(gf, arg, pos, subr) \
  return ((gf) \
          ? scm_call_generic_0 ((gf)) \
          : scm_wta ((arg), (char *) (pos), (subr)))

This will not compile with strict typing.  A quick hack would simply
unpack the 'gf', thus still assuming that a zero content indicates an
uninitialized state.  A cleaner solution would assign #f or UNDEFINED or
something else, but  this means that the value has to be compared with
that value rather than just testing for zero.

Maybe someone with more intimate knowledge of the implementation of
generic functions should give some comments on how to deal with this?

Best regards
Dirk Herrmann


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