Hi Jeremy, As I understand it, alien.marshall converts a C struct into a Factor tuple by copying the fields over into slots. Recently Joe pushed a classes.struct vocabulary, which implements a nice sugar for defining one-slot tuples that overload accessors to access fields of the underlying struct. It also integrates with the alien.c-types vocabulary so that struct objects can be passed as function parameters and returned as values.
My plan is to eventually replace alien.structs (and C-STRUCT:) with Joe's struct classes completely. They're superior to the current alien structs because they're strongly typed (with current structs you just pass a byte array around) and it uses 'new' accessors (instead of set-structname-fieldname). I think if alien.marshall used classes.struct instead of doing its own thing with structs, it could be a lot simpler, and still satisfy all the use-cases you had in mind for the Qt binding -- for instance, you can define methods on struct classes, etc. They even prettyprint and have literal syntax. In addition to structs, it looks like alien.marshall also has some support for out parameters, and automatic memory allocation for passing values by reference. Some of this might overlap with what alien.fortran does for the Fortran ABI, where in effect all values are passed by reference, and out parameters are frequently used to return values. Also there are many places in the library that use this idiom for out parameters: 0 <uint> [ "hi" 1 t some_c_function ] keep *uint Ideally it would be encoded in the function prototype itself, and malloced memory (with a destructor) would be used instead of a Factor heap allocated <uint>. It would be great if we had a common support for dealing with out parameters at the alien-invoke level, since all of this could then use the same set of utilities, making such code more robust and easier to write. Do you want to take a look at this at some point? Slava ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk