neko & val_gc

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

neko & val_gc

Gamehaxe
Hi (Nicolas mainly),
Is there any special reason why finalizers can only be applied to
abstract objects in neko?  Besides that fact that it might be
an unusual thing to want to do?
hxcpp mirrored this behaviour until recently, but I have found
a need (weak references) for putting finalizers on any type of object.


EXTERN void val_gc(value v, finalizer f ) {
         if( !val_is_abstract(v) )
                 failure("val_gc");



Hugh

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: neko & val_gc

Nicolas Cannasse
Le 02/11/2011 16:06, Gamehaxe a écrit :
> Hi (Nicolas mainly),
> Is there any special reason why finalizers can only be applied to
> abstract objects in neko? Besides that fact that it might be
> an unusual thing to want to do?
> hxcpp mirrored this behaviour until recently, but I have found
> a need (weak references) for putting finalizers on any type of object.

Actually Boehm GC can put finalizers on any block, but I wanted to
restrict usage to abstracts-only for the time when I will write a neko
custom GC. This could be an optimization by checking finalization only
for abstracts and not other kind of blocks.

I guess you can bypass this restriction in hxCPP, but I would like to
keep it in NekoVM.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org