Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-05-03 14:01:45


scleary_at_[hidden] wrote:

> Reference counting could probably be accounted for in the header/footer
> info, and arbitrary allocators can be used if you put alignment restrictions
> on them (as I do in Pool's UserAllocator).

        I'm not sure I follow.

> The first point (allowing user deletion) is more tricky;

        Yes, it is. I'm uncertain how to do this.
With reference counting, it is not necessary for acyclic
data structures. It may not be necessary, even for cyclic
ones. I'm not sure, yet.

> there is one possibility, though:
> I'm assuming that you have a special pointer type (or reference-counting
> pointer type)

        No. The collector works with ordinary pointers.

> I don't know what exactly you're trying to do with your library, so I can't
> say if this change is feasable or not; it's just a thought...

        The purpose of the library, in the first instance, is to
allow collection of C++ objects (with finalisation).

        gc1 doesn't support reference counting.
The client calls 'collect', and garbage is collected in random
order, finalisers are executed.

        This is quite sufficient for many data structures.
However, if one is using constructors/destructors for resource
acquisition/release, and there are dependencies amoung the
resources, it isn't enough. Also, it can be very expensive to
call the collector to release scarce resources in a timely
manner. Hence, I see a need to add reference counting.
This would allow release and finalisation of objects
_immediately_ the object becomes unreachable, provided the object
isn't part of a cycle.

        Immediate release also helps minimise the work of the collector.
In fact, the collector could be eliminated entirely in some cases.

-----------------------------------------------------------------------

        For your information, the background is as follows:
I'm developing a new programming language called Felix, which
solves many of the problems in C++. For example, it provides
a garbage collector :-) It also features sane declarator syntax,
overloading, a purely functional expression sublanguage, pattern
matching,
nested functions including anonymous lambdas and currying,
structs, tuples, discriminated unions, modules, functors,
and type inference for variables.

        Felix has no predefined types! Instead, it provides
a binding sub-language for binding C++ types. ALL Felix
types are accessed abstractly. Felix is a C++ code generator:
it utilises C++ compiler optimisations to produce very fast code,
at the same time, it can use your existing C++ class types.

        Felix does one other thing: it provides what I call
'control inversion'. You write code designed as a thread,
but the generated code is event driven for efficiency.
The generated code has been tested with trivial messages
on a 450MHz Linux box and ran 1 million threads passing
2 million messages is a minute. Applications include
large scale server based GUI's and telephone systems.
But you can write ordinary programs too :-)

-- 
John (Max) Skaller, mailto:skaller_at_[hidden]
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk