English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
Obj.magic and existential types.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-06-22 (09:19)
From: Benjamin Canou <benjamin.canou@g...>
Subject: Re: [Caml-list] Re: Obj.magic and existential types.
Daniel Bünzli a écrit :
> Le 21 juin 09 ŕ 20:08, Jake Donham a écrit :
>> I have not tried either, but from a cursory glance at the code I have 
>> the impression that React's space safety relies on support for weak 
>> references, which standard Javascript does not have.
> Yes.
> The weak module is available in obrowser, but I don't know if it 
> implements its semantics. If the author of obrowser is on this list 
> would he be kind enough to enlight us ?
Abstract: The weak.js file remaining in the distro is a mistake. I see 
possibilities to implement them but have no short term plans for a 
perfect solution.

Well... there is no such a file as this garbage weak.js in the 
distribution, it must have spawn by itself in your computer ;-)
Indeed there is no such mechanism in JS. I have ideas to implement them 
on top of JS, in particular a trivial solution involving reference 
counters and updating weak arrays incrementally every N VM instructions 
could suffice in some cases (but induce memory leaks in presence of 
cycles through the weak value, of course). There are more satisfying 
possibilities but I have yet to figure out one with good complexity, 
incremental, and not too hard to implement (in particular not too 
intrusive in other parts of the VM).

PS: btw, there is now a darcs repo for obrowser at ocsigen.org for those 
who didn't know