guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: continuation barriers


From: Linas Vepstas
Subject: Re: continuation barriers
Date: Fri, 28 Aug 2009 16:42:15 -0500

Hi Neil,

2009/8/26 Neil Jerram <address@hidden>:
> Linas Vepstas <address@hidden> writes:
>
>> i.e. I'd like something like this to work:
>>
>> scm_c_eval_string(" ... (call/cc (lambda (k) (set! *myk* k))) ...");
>> ... some_c_code(...);
>> scm_c_eval_string(" ... (*myk* 42) ...");
>
> I think there are a couple of problems here.
>
> The first is as you've noted, that scm_c_eval_string() has a
> scm_c_with_continuation_barrier() hiding inside it.

I mis-spoke or mis-implied -- the thing holding the continuation
barrier is scm_with_guile().  There may also be one within
scm_c_eval_str() although I did not immediately spot it.

> You can avoid
> that by using some other method for calling from C into Scheme, for
> example:

What you described would seem to work, except that what I really
need is a a variant of scm_with_guile() without the continuation
barrier.   Or rather, a variant of scm_with_guile() which uses a
continuation barrier only if the stack underneath is *different*
than what it was when the continuation was defined.  (Right?
since if the stack is the same, using the continuation can't
mess up the stack.)

I think that what I suggest is straightforward to code up: and
I think its safe.  Would anyone care for a patch against 1.9.2 or
1.9.3 or whatever?

--linas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]