This page is part of the web mail archives of SRFI 50 from before July 7th, 2015. The new archives for SRFI 50 contain all messages, not just those from before July 7th, 2015.
>>>>> "Tom" == Tom Lord <lord@xxxxxxx> writes: >> From: Michael Sperber <sperber@xxxxxxxxxxxxxxxxxxxxxxxxxxx> Tom> Since the mechanism of these non-local exits is not Tom> specified and can not be modified by C code, the FFI Tom> contains no provision for them to perform unwind protection Tom> --- that's a serious omission. >> But SCHEME_CALL takes you back to Scheme, where you can use >> DYNAMIC-WIND. >> I think I misunderstand your point. Tom> A sketch that illustrates the issue: Tom> my_fn () Tom> { Tom> int fd; Tom> fd = open ("somefile", O_RDONLY, 0); Tom> SCHEME_CALL ( [...] ); Tom> close (fd); Tom> } Of course, you're not supposed to do this. You're supposed to do (very roughly): scheme_value my_open() { return SCHEME_ENTER_LONG((long) open ("somefile", O_RDONLY, 0)); } ... scheme_value my_close(scheme_value fd) { close((int) SCHEME_EXTRACT_LONG(fd)); } ... and handle the non-local control flow from Scheme. C just isn't powerful enough to play these games gracefully. -- Cheers =8-} Mike Friede, Völkerverständigung und überhaupt blabla