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: New smob interface


Greg Badros <badros@cs.washington.edu> writes:

> I'm planning on adding:
> 
> void
> scm_set_smob_fns(long tc, 
>                  SCM (*mark) (SCM),
>                  scm_sizet (*free) (SCM),
>                  int (*print) (SCM, SCM, scm_print_state*),
>                  SCM (*equalp) (SCM, SCM));

> extern void scm_make_smob_type_fns(char *name, scm_sizet size,
>                                    SCM (*mark) (SCM),
>                                    scm_sizet (*free) (SCM),
>                                    int (*print) (SCM, SCM, scm_print_state*),
>                                    SCM (*equalp) (SCM, SCM));

If you think this saves a lot of typing, then it's OK with me, but I'd
like the other functions to stay.

> Is there a reason why this wasn't preferred before?

I observed that while I had no problems with remembering the types of
the functions (because they follow fairly naturally from their
purposes) I constantly had to look up their order.  And I think

  scm_tc16_arbiter = scm_make_smob_type ("arbiter", 0);
  scm_set_smob_mark (scm_tc16_arbiter, scm_markcdr);
  scm_set_smob_print (scm_tc16_arbiter, prinarb);

is clearer (easier to see the meaning) than

  scm_tc16_arbiter = 
    scm_make_smob_type_fns ("arbiter", 0, 
                            scm_markcdr, NULL, prinarb, NULL);

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