[Caml-list] recursive records with weak hashtbl

2009-03-04 Thread Vsevolod Fedorov
Hello! I want to define two records referencing each other. First record (A) has direct reference to second (B) and second (B) has weak hash table to list records A, which have reference to it. For example (pseudo code): type a { id : int ; mutable field1 : string; mutable b : B; } type b

Re: [Caml-list] recursive records with weak hashtbl

2009-03-04 Thread Florent Ouchet
Vsevolod Fedorov a e'crit : snip Is it possible at all? Yes, you have to use type .. and .. ;; statements for instance: type a = { id : int ; mutable field_1 : string; mutable field_b : b; } and b = { id : int; mutable field_2 : string; field_a_list : a array; (* they referenced me *) };;

Re: [Caml-list] recursive records with weak hashtbl

2009-03-04 Thread Virgile Prevosto
Hello, Le mer. 04 mars 2009 16:31:02 CET, Vsevolod Fedorov sevaatw...@mail.ru a écrit : type a { id : int ; mutable field1 : string; mutable b : B; } type b { id : int; mutable field2 : string; a_list : Weak-Hashtbl(a); (* they referenced me *) } Is it possible

Re: [Caml-list] recursive records with weak hashtbl

2009-03-04 Thread Martin Jambon
Vsevolod Fedorov wrote: Hello! I want to define two records referencing each other. First record (A) has direct reference to second (B) and second (B) has weak hash table to list records A, which have reference to it. For example (pseudo code): type a { id : int ; mutable field1 :

Re: [Caml-list] recursive records with weak hashtbl

2009-03-04 Thread Christophe TROESTLER
On Wed, 4 Mar 2009 16:31:02 +0300, Vsevolod Fedorov wrote: I want to define two records referencing each other. First record (A) has direct reference to second (B) and second (B) has weak hash table to list records A, which have reference to it. For example (pseudo code): type a { id :