Hello,
I cannot get list.remove to work as expected.
Here's a code snippet that properly works:
ref_shutdown_hooks = ref []
def do_shutdown_hook(hook_list) =
list.iter(fun(x) -> x(), hook_list)
end
on_shutdown(fun() -> do_shutdown_hook(!ref_shutdown_hooks))
Then I can fill in that list with few different on_output_shutdown
functions using this command (same name but different instances of that
function):
ref_shutdown_hooks := list.append([on_output_shutdown], !ref_shutdown_hooks)
On global shutdown, all the functions stored are properly called. It
works OK.
BUT, now, if I try to remove a function from that list it doesn't work.
If I type:
ref_shutdown_hooks := list.remove(on_output_shutdown, !ref_shutdown_hooks)
I get a nasty:
Error when leaving output /play: File "lang/lang_builtins.ml", line 498,
characters 11-17: Assertion failed!
Note that this specific on_output_shutdown is sure to be in the list
before deletion.
I can check using: list.iter(fun(x) -> print(x), !ref_shutdown_hooks)
and it displays several "<fun>" as expected.
What's wrong? I can add but not remove functions from lists?
Important piece of information: I'm running v1.0.1 under Cygwin, it's
the only environment I can test on right now
--
regards,
okay_awright
<okay_awright AT ddcr DOT biz>
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users