> I was wondering if it is indeed possible to implement a garbage
> collector in Eiffel itself.
As you said, you wouldn't be able to change the allocator called from
create instructions/expressions. On the other hand, a factory could use
`from_external' to allocate memory for Eiffel objects from Eiffel. You
could probably get introspection to work for detecting live objects (in
the mark phase of a garbage collector), presumably slowly. Caveat:
creating `TYPED_INTERNALS' object from the garbage collector smells funny
(although I've been toying with for quite some time the idea of changing
INTERNALS to make a clever implementation possible where no actual object
needs to be allocated for the TYPED_INTERNAL).
> Beside the obvious support required by the compiler to customize object
> creation from Eiffel, is there any specific reason to keep the GC
> implemented in C?
Actually, it's an idea I've been entertaining for years. The GC is a
complex piece of software that would really benefit from contracts. The
reason I haven't done it (yet?) is that it takes a lot of work to design a
clean Eiffel interface for the beast, and yet more work to actually
implement it. Actually, one of the reasons I Wrote the introspection
support was to take a first stab at exposing the Eiffel runtime to the
Eiffel code.
I don't think I'll be able to contribute a lot to 'GC in Eiffel' project,
should you take it up -I already have too many projects on ice- but I'll
definitely be interested.
Cheers
--
Frederic Merizen