This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: SCM_SMOB_TAG smob abstraction
- To: Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se>
- Subject: Re: SCM_SMOB_TAG smob abstraction
- From: Dirk Herrmann <dirk@ida.ing.tu-bs.de>
- Date: Thu, 9 Sep 1999 11:51:17 +0200 (MEST)
- cc: Greg Badros <gjb@cs.washington.edu>, Guile Mailing List <guile@sourceware.cygnus.com>
On 9 Sep 1999, Mikael Djurfeldt wrote:
> I think that maybe what Dirk and you are after is that you want smob
> to be a sub-type and you want a macro to distinguish a smob from other
> smobs. But then you'd need to make two tests:
>
> #define SCM_FOOP(x) (SCM_SMOBP (x) && SCM_SMOBNUM (x) == smobnum_foo)
You are right: This is what I was thinking of and I even forgot about
the existence of SCM_SMOBNUM. Sorry for that.
However, IIRC some time ago I had suggested to introduce a macro which
performs the above test in one go.
> I don't see a strong enough reason to change this in the scm
> interface. I *do* think that we should implement a really easy way to
> handle user defined types in the gh interface.
Sure, this would definitely be a better way, although I can not imagine
yet what this interface would look like. Still, even for implementors
of guile internals it would IMHO make sense to provide macros for
frequently used patterns like the test for a specific type of smob.
Best regards,
Dirk Herrmann