[Gc] C++ API enhancement proposal

skaller skaller at users.sourceforge.net
Mon Oct 15 16:28:34 PDT 2007


On Mon, 2007-10-15 at 11:45 -0700, MenTaLguY wrote:
> On Mon, 15 Oct 2007 16:31:14 +1000, skaller <skaller at users.sourceforge.net> wrote:
> > A pity sometimes you have to cope with bad interfaces,
> > that is one valid reason for single objects .. still,
> > you should always write your code to accept explicitly
> > passed pointers even if there is currently no apparent
> > reason.
> 
> Using explict arguments is much preferred (if nothing else
> it grants you considerable benefits when testing), but
> that's orthogonal to whether one decides to have a single,
> unique instance of a particular sort of object, which may be
> required by what you're modeling[1].

Of course, then you just make one of them in the mainline.

> [1] For instance, an object modeling "the operating system
> the current process is executing under"

.. but you realise your 'process' is actually multiple
synchronised Erlang programs and the OS is called the
Internet .. distributed garbage collector anyone? :)

Or, your client decides to compare Linux with Windows,
you wouldn't want to rewrite all that code because you 
used a global variable for 'the' operating system model.

In fact I am struggling to find a use for multiple
garbage collectors in a shared memory computer, but it may
make sense for a dynamically maintained abstracted graph,
where the node addresses are hidden from the user of the graph.
Each graph could then have its own collector.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


More information about the Gc mailing list