Re: [Caml-list] OCaml and Boehm
Is the OCaml runtime Boehm-safe? That is, can it be run with Boehm turned on and traversing OCaml's heap? (So that the OCaml heap can provide roots to Boehm.) I conjecture the answer is yes, although it's hard to tell for sure without a precise specification of what is/is not OK with the Boehm-Demers-Weiser collector. From the standpoint of this collector, OCaml's heap is just a set of large-ish blocks allocated with malloc() (*) and containing a zillion pointers within those blocks. OCaml doesn't play any dirty tricks with pointers: no xoring of two pointers, no pointers represented as offsets from a base, no pointers one below or one above a malloc-ed block. Most pointers are word-aligned but we sometimes play tricks with the low 2 bits. Of course, almost all Caml pointers point inside those malloc-ed blocks, not to the beginning, but I'm confident that the B-D-W collector can handle this, otherwise it would fail on pretty much any existing C code. This said, I agree with Basile that what you're trying to achieve (coexistence between several GCs) is risky, and that a design based on message passing and separated memory spaces would be more robust, if feasible. - Xavier Leroy (*) In 3.10 and earlier releases, OCaml sometimes used mmap() instead of malloc() to obtain these blocks. Starting from 3.11, malloc() is the only interface OCaml uses to obtain memory from the OS. ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] Camlp4 help
On Sun, 2009-04-12 at 21:05 -0300, Andre Nathan wrote: If I simplify the rule above to forall; (; gen = expr; ); var = ipatt; .; e1 = expr; impl = OPT =; e2 = OPT expr - then everything after the dot is bound to e1, even when there's a =. For the archives, this happens because = is a valid infix operator name, and thus is matched by e1 = expr. Changing it to - did the trick. Thanks to bluestorm at #ocaml for that :) Andre ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] Re: How to achieve this camlp4 syntax extension
On 4/2/2009 1:42 PM, Conglun Yao wrote: Different kinds of error happened, when trying to use it. Even the ordinary expression: List.length [1; 2;3 ], failed. 'List' is parsed as module_longident, try to match the rule I defined. Not sure whether you are still looking for a solution to this but, as it was not possible to use theses constructions together with pa_do (same grammar rule to modify), I added hooks so you can provide your own functions for them. E.g., val module_square_brackets : (module_longident - Loc.t - expr - expr) ref allows you to replace [M.[ e ]] by [!module_square_brackets m _loc e] where [m] is the internal representation of [M] and [_loc] is the location of the whole expression [M.[ e ]]. This is available in the last version of delimited overloading (downloadable at http://pa-do.forge.ocamlcore.org/ ). Hope it helps, ChriS ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
[Caml-list] [ANN]Amthing - a multi-threaded GUI library
Hello list, I'm please to announce the first public release of Amthing, a multi-threaded GUI library for OCaml. Features are: - Multi-threaded design using Concurrent ML style message passing. - Time-line animation and functional reactive sprite system. - X11 Binding. - 2D vector rendering by cairo. Here's a Hello world example of Amthing. open Ccell open Event open Amthing.Util.Persavatives module W = Amthing.Core.Window ( Amthing.XWindow ) module K = Amthing.KeyCode module E = Amthing.WinEvent module S = Amthing.Sprite module C = Amthing.Component let wh = W.make (Amthing.XWindow.default_parameter ()) let tc = lazy (W.make_text_context wh) let _ = W.resize wh {| x = 0; y = 0; w = 200; h = 200 |}; let hello = new S.label !$tc hello world! + S.set (`X 55.) + S.set (`Y 90.) + S.set (`Color Amthing.Color.blue) + C.make in W.add_visible wh hello; W.set_title wh amthing hello world!; W.show wh; let main_loop () = match select [ Bcast.receive (W.event wh) ] with `KEY_PRESS input when E.key_code input = Some K._q - W.close wh; exit 0 | #E.t - () in forever main_loop () you can clone the repository from OCamlForge subversion : svn checkout svn://svn.forge.ocamlcore.org/svnroot/amthing or view souce code on the web. http://forge.ocamlcore.org/plugins/scmsvn/viewcvs.php/trunk/?root=amthing have fun, --- Ogasawara Satoshi | - Email: ogasaw...@itpl.co.jp ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs