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] |
Mikael Djurfeldt <mdj@nada.kth.se> writes: <snip> > *and* switch the order between the SETCAR and SETCDR, writing, instead > of the above: > > SCM_NEWCELL (z); > SCM_SETCDR (z, <malloced memory>); > SCM_SETCAR (z, scm_tc16_<name>); If this is acceptable, I'd also suggest introducing a new, higher-level abstraction for initializing a SMOB instance. In Scwm, we have: #define SCWM_NEWCELL_SMOB(ANSWER,ID,PSMOB) \ do { \ SCM_NEWCELL((ANSWER)); \ SCM_SETCDR((ANSWER),(SCM) (PSMOB)); \ SCM_SETCAR((ANSWER),(ID)); \ } while (0) The pattern occurs frequently enough that it's definitely worth abstracting -- if this had already been done, the change you suggest would just be a change to the macro definition, and not to lots of lines of code. When making the change is the perfect time to raise the level of abstraction so that future changes will be less painful. Greg