From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p65HVxFQ020948 for ; Tue, 5 Jul 2011 19:31:59 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AosCAApJE07UGyoCkWdsb2JhbABTmROOdhQBAQEBCQsLBxQDIoh8wiKGNgSSNoR4HYsj X-IronPort-AV: E=Sophos;i="4.65,480,1304287200"; d="scan'208";a="98029896" Received: from smtp2-g21.free.fr ([212.27.42.2]) by mail2-smtp-roc.national.inria.fr with ESMTP; 05 Jul 2011 19:31:53 +0200 Received: from [192.168.1.3] (unknown [82.237.71.191]) by smtp2-g21.free.fr (Postfix) with ESMTP id DE8034B0124 for ; Tue, 5 Jul 2011 19:31:46 +0200 (CEST) Message-ID: <4E134A89.7070307@inria.fr> Date: Tue, 05 Jul 2011 19:31:53 +0200 From: Xavier Leroy User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: caml-list@inria.fr References: <4E133C2F.6050202@soton.ac.uk> In-Reply-To: <4E133C2F.6050202@soton.ac.uk> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Nested callbacks? On 07/05/2011 06:30 PM, Thomas Fischbacher wrote: > > Dmitry Bely wrote: > >> Is it allowed to call a Caml closure from C (caml_callbackN_exn), that >> calls another Caml closure internally (also with caml_callbackN_exn)? > > I strongly hope so! If this did not work, that would have disastrous > consequences for the tight integration of Caml and Python which we are > using. (Well, so far, we never encountered a problem with that. And the > documentation does not warn against doing this - so, should it not work, > that should be considered a bug.) Indeed, it should work, and I see no reason why nested callbacks could fail. Callbacks do save some Caml-specific state and restore it before returning, but they use the stack to do so, so they should be reentrant. Please file a bug report if you find out they are not. - Xavier Leroy