Thanks Will! I tried it and it works ;) except the generic make method - i.e. can't do (make <my-struct> ...). <br><br>After looking at the defstruct code - it appears that it calls a private function called struct-type->class* and this function builds on top of struct-type->class and use it to track the slots for all the types created via defstruct and thus allow the structs to be created via made.
<br><br>I guess to fully integrate with the make method the function struct-type->class* should be exported...?<br><br>Thanks!<br>yc<br><br><div><span class="gmail_quote">On 9/6/07, <b class="gmail_sendername">Will M Farr
</b> <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Sep 6, 2007, at 2:43 PM, YC wrote:
<br><br>> Hi all -<br>><br>> how can one create a custom struct (i.e. make-struct-type or define-<br>> struct* from ryanc) but make it work with swindle's object system?<br><br>Keep the structure type descriptor (the first value which make-struct-
<br>type returns), and use swindle's struct-type->class on that<br>descriptor to obtain a class object which describes structs of that<br>type. For example:<br><br>(define-values (struct:my-struct make-my-struct my-struct? my-struct-
<br>get my-struct-set!)<br> (make-struct-type 'my-struct #f 1 0))<br><br>(define <my-struct> (struct-type->class struct:my-struct))<br><br>Now you can use <my-struct> anywhere a class object could be used in