On Sun 27 Apr 2014 18:00, Mark H Weaver writes: > Andy Wingo writes: > >> I propose to provide a new interface that will eventually make SMOBs >> obsolete. This new interface is based on structs with raw fields -- the >> 'u' fields. (See >> http://www.gnu.org/software/guile/docs/master/guile.html/Vtables.html#Vtables >> for description of 'u' fields. Note that the documentation is wrong -- >> these fields are indeed traced by the GC.) > > Sounds like a good idea, in general. Thanks; with this note, Ludo's approbation, and a doc update I feel OK with pushing to stable-2.0. Let's hammer out the details there. >> SCM scm_make_foreign_object_1 (SCM type, scm_t_bits val0); >> SCM scm_make_foreign_object_2 (SCM type, scm_t_bits val0, >> scm_t_bits val1); >> SCM scm_make_foreign_object_3 (SCM type, scm_t_bits val0, >> scm_t_bits val1, scm_t_bits val2); > > If we include an interface like this, I think we should have more of > these, but see below. I changed this interface to take void* pointers, with the idea that that's the common thing. Same with scm_foreign_object_ref. But I added scm_foreign_object_signed_ref, unsigned_set_x, etc, with notes in the manual that you can indeed provide fewer initializers than fields, and then initialize the fields yourself later. > #ifndef __GNUC__ > if (bits > SCM_T_SIGNED_BITS_MAX) > return -1 - (scm_t_signed_bits) ~bits; > #endif > return (scm_t_signed_bits) bits; > } I think I forgot to actually implement this bit though :P Tutorial-style documentation (in the Programming in C chapter, replacing the SMOB tutorial) attached. There is also reference-style documentation in the API chapter. Andy