Re: RFC: Foreign objects facility

2014-04-29 Thread Doug Evans
On Sun, Apr 27, 2014 at 6:17 AM, Andy Wingo wrote: > Hi, > > SMOBs have a few problems. > > 1) They are limited in number to 255. > > 2) It's difficult to refer to a SMOB type from Scheme. You can use > class-of once you have an object, but the class-of isn't exactly > the same as t

Re: RFC: Foreign objects facility

2014-04-29 Thread Doug Evans
On Mon, Apr 28, 2014 at 9:08 AM, Andy Wingo wrote: > [...] > 1.4 Foreign Object Memory Management > > > Once a foreign object has been released to the tender mercies of the > Scheme system, it must be prepared to survive garbage collection. In > the example ab

Identifying what's usable in installed headers [was Re: RFC: Foreign objects facility]

2014-04-29 Thread Doug Evans
On Sun, Apr 27, 2014 at 6:17 AM, Andy Wingo wrote: > Hi, > > SMOBs have a few problems. > > [...] > 7) There is legacy code out there that uses e.g. SCM_SETCDR to set > smob fields. (This is terrible, but it exists: > https://github.com/search?q=SCM_SETCDR+smob&ref=cmdform&type=Code >

Re: RFC: Foreign objects facility

2014-04-29 Thread Andy Wingo
Hi! Thanks for the feedback, it's really useful. On Tue 29 Apr 2014 17:56, Doug Evans writes: > The struct interface, contrary to what the documentation says, takes a > stdarg list beginning with the number of fields (and not terminated > with SCM_UNDEFINED), instead of _1, _2, _3 This is what

Re: RFC: Foreign objects facility

2014-04-29 Thread Andy Wingo
Hi! On Tue 29 Apr 2014 18:08, Doug Evans writes: > Hi. fwiw, this is all great stuff (and welcome!), but I think it's in > the wrong place in the docs. > The issue comes up in multiple places, so I would write it ("it" being > the general prose regarding issues with finalizers) once and refer to

Re: Identifying what's usable in installed headers [was Re: RFC: Foreign objects facility]

2014-04-29 Thread Andy Wingo
Hi! On Tue 29 Apr 2014 18:33, Doug Evans writes: > On Sun, Apr 27, 2014 at 6:17 AM, Andy Wingo wrote: >> >> [...] >> 7) There is legacy code out there that uses e.g. SCM_SETCDR to set >> smob fields. (This is terrible, but it exists: >> https://github.com/search?q=SCM_SETCDR+smob&r

guile struct members are not a good 1-1 match for c structs

2014-04-29 Thread Doug Evans
Hi all. While reading guile sources I happened across the implementation of struct scm_print_state. ref: libguile/print.h It (tries to) map a C struct to a set of Guile struct fields: ref: SCM_PRINT_STATE_LAYOUT. I *could* be missing something, but I think my angst can be represented with the f

GC for logic programming

2014-04-29 Thread Stefan Israelsson Tampe
One of the benefits of using a mutating stack for the variable bindings are that one can introduce proper gc of prolog programs, that is a feature that would benifit guile-log logic programs and the kanren and prolog interfaces. The current options are to use a light version that take care of some