From: William Djaja Tjokroaminata Date: 2002-09-04T23:24:27+09:00 Subject: Re: Best GC for Ruby? Hi, It seems that the example shows the convenience of bringing in the power of C++. I haven't started or thought about it, as the Pickaxe book says "...including awkward marriages of Ruby and C++, ...". I know that someone is rewriting Ruby in Java (JRuby); might this show the advantages of writing Ruby in C++ instead of in C? Regards, Bill ========================================================================== Justin Johnson wrote: > Interestingly, in my implementation I've got a class called RbValue which > represents Rubys internal VALUE. There's more to it though. It can take > the behaviour of an integer or a pointer to an object. The '=' operator is > overloaded and there is significant debug only safety code. An RbValue > object can cast to an RbObject* if it's setup as an RbObject*. > Example: > RbValue Value1 = 10; // Value is an integer (FIXNUM) > 10 > RbValue PtrObject = pObjectA; // Value is an object ptr. > Because the '=' operator is overloaded (with an inline so it retains speed > in release builds) I have an ideal point at which to intercept the setting > of RbValues that are pointers to objects. It would also be possible (and > desirable?) to create a destructor for RbValues that deregisters them from > remembered sets. I'll have to think about that. > For C code I don't think you can get away from having to use macros.