Version française
Home     About     Download     Resources     Contact us    
Browse thread
Unset or remove an OCaml callback registration
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Hezekiah M. Carty <hcarty@a...>
Subject: Unset or remove an OCaml callback registration
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