archives

The right default: concurrent components with message passing

Here's something to offset all the
long discussions on typing that
have been taking place recently
(see Concurrent Components With Message Passing):

In our experience, the right default for structuring programs is as concurrent components that communicate through asynchronous message passing. Components should be sequential or communicate synchronously only if necessary. This is not a new idea; Carl Hewitt anticipated it thirty years ago in the Actor model. But today we have many strong reasons for accepting it. For example: [...] (discussion continues with
references to Erlang, E, and CTM)
[...] Unfortunately, these reasons and their conclusion are almost completely ignored by mainstream languages and by books on program design. In both, object-oriented programming and shared-state concurrency are given priority, even though they are the wrong default. [...]

So, is this heresy or an unfortunately ignored truth?

hierarchy destruction in Ada

Ada 95 provides a mechanism with tagged and type'class to allow dynamic dispatch. So if one has:

procedure something (O : basetype'class) is
begin
enact (O);
end something;

then as we all know, with the appropriate redefinitions of enact () for the subtypes of basetype, we have dynamic dispatch.

But what about deallocation ? I want to declare:

type handle is access all basetype;

procedure dispose (ptr : in out handle);

and can't see how to make this deallocate the correct object. Obviously, one can dynamically dispatch on ptr.all but it seems impossible to solve the complete problem without an unchecked conversion. Anyone ?