This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
generic functions
- To: Guile Mailing List <guile at sourceware dot cygnus dot com>
- Subject: generic functions
- From: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Date: Tue, 4 Apr 2000 14:44:18 +0200 (MEST)
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