[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: non-local exits are icky
>>>>> "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
>> I think I misunderstand your point.
Tom> A sketch that illustrates the issue:
Tom> my_fn ()
Tom> int fd;
Tom> fd = open ("somefile", O_RDONLY, 0);
Tom> SCHEME_CALL ( [...] );
Tom> close (fd);
Of course, you're not supposed to do this. You're supposed to do
return SCHEME_ENTER_LONG((long) open ("somefile", O_RDONLY, 0));
scheme_value my_close(scheme_value 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