From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id C9D62BBCA for ; Wed, 2 Apr 2008 20:12:14 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEABJp80fAXQIn/2dsb2JhbACsQg X-IronPort-AV: E=Sophos;i="4.25,594,1199660400"; d="scan'208";a="10990919" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 02 Apr 2008 20:12:14 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m32IC9b6003310 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 2 Apr 2008 20:12:14 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvABANdo80fRVYTwd2dsb2JhbACRTwEMBQIFCRSaPA X-IronPort-AV: E=Sophos;i="4.25,594,1199660400"; d="scan'208";a="9116059" Received: from an-out-0708.google.com ([209.85.132.240]) by mail2-smtp-roc.national.inria.fr with ESMTP; 02 Apr 2008 20:12:11 +0200 Received: by an-out-0708.google.com with SMTP id c24so675864ana.97 for ; Wed, 02 Apr 2008 11:12:10 -0700 (PDT) Received: by 10.100.58.19 with SMTP id g19mr23287903ana.12.1207159930162; Wed, 02 Apr 2008 11:12:10 -0700 (PDT) Received: by 10.100.174.13 with HTTP; Wed, 2 Apr 2008 11:12:10 -0700 (PDT) Message-ID: <3a360f590804021112r1cba67d9yc1715c08fb4a2e92@mail.gmail.com> Date: Wed, 2 Apr 2008 14:12:10 -0400 From: "Hezekiah M. Carty" Sender: hcarty@mulethief.com To: "Caml-list List" Subject: Unset or remove an OCaml callback registration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: 0501383eb1d0b13f X-Miltered: at concorde with ID 47F3CC79.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; unset:01 ocaml:01 foo:01 foo:01 ocaml:01 unregistered:98 undefined:01 func:01 func:01 callback:02 callback:02 library:03 library:03 transform:05 transform:05 Is it possible to unregister a function or other value registered with Callback.register? I use (Callback.register "foo" some_func) to register coordinate transforms for a C library. If no callback is registered for "foo" then a default transform is used by the C library. I would like to be able to set and then remove the association of some_func to the name "foo" at various points in my program so that the C code will fall back on the default transform (which does not require a callback and is much faster) when the named callback "foo" is undefined or has been unregistered. Is this possible, either from the C or OCaml side without making the callback associate with "foo" an option type (use (Callback.register "foo" (Some some_func)) to set a callback and (Callback.register "foo" None) to clear it)? Thanks, Hez -- Hezekiah M. Carty Graduate Research Assistant University of Maryland Department of Atmospheric and Oceanic Science