Hi,
This error comes from the fact that comparing two functions is not
implemented (yet). The following patch makes it work, at least in my
simple tests, but I'm not so fond of it so I won't commit it as is.
diff --git a/src/lang/lang_builtins.ml b/src/lang/lang_builtins.ml
index 10305b1..18c4100 100644
--- a/src/lang/lang_builtins.ml
+++ b/src/lang/lang_builtins.ml
@@ -554,6 +554,7 @@ let compare_value a b =
if c=0 then cmp (l1,l2) else c
in
cmp (l1,l2)
+ | (Lang.Fun _ as f1), (Lang.Fun _ as f2) -> compare f1 f2
| _ -> assert false
in
aux (a.Lang.value,b.Lang.value)
On Mon, Nov 4, 2013 at 12:22 AM, okay_awright <[email protected]> wrote:
> 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
------------------------------------------------------------------------------
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