Brought across from bug-guile ... [EMAIL PROTECTED] (Ludovic Courtès) writes: > > Actually, `scm_i_struct_equalp ()' should also compare the "tail > elements" (when there are tail elements),
Is it as easy as using getting the size (of each) from "scm_struct_i_n_words", instead of just using the layout? I see scm_struct_ref uses that for its range check. > but their semantics are a > little fuzzy to me. In particular, I don't understand why the size of > the tail array can be specified in both `make-vtable-vtable' and > `make-struct': What does that mean? Nosing around the code, I think make-vtable-vtable adds space to the vtable (or rather vtable-vtable) struct like "class data". Then make-struct adds space to a struct created from it like "instance data". > Which one should really be taken into account? Both :-). But since both are structs I think both birds can be killed with the one stone. > It seems that the code is a bit unclear on this too: > > guile> (define v (make-vtable-vtable "pr" 0)) > guile> (define s (make-struct v 123)) > guile> (struct-ref s 10) > Segmentation fault Digging around I think that to have a tail array you're meant to say "pR" or "pW" or whatever at the end of the layout. Without R, W or O then it looks like the internal func scm_struct_init doesn't initialize the tail array contents, so then scm_struct_ref reads out garbage as an SCM, and that can cause a segv if you attempt to print it. Should make-struct throw an error, or should it initialize? I guess initializing is the smallest change, but it looks like struct-set! refuses to work in the tail part without "W" at the end, so maybe R,W,O is how it's meant to be. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel