Erlang hints from an CO junkie

Chris Pressey <>
Thu Aug 12 23:50:01 CEST 2004


On Fri, 13 Aug 2004 00:47:40 +0400
"Vlad Balin" <> wrote:

> And suppose you have 2 different implementation of the same
> ADT. There's no principal reasons not to do so, in other 
> case it's not quite 'abstract'. You pass your ADT instances 
> as a parameter to this function.
> 
> Since ADT is defined by the set of operations _only_, I would
> expect function to work properly for both instances, i. e. that 
> function will not notice the difference - operations are the same, 
> so type should be the same too!
> But it _will_ work properly _only_ in case, if operations will 
> be _associated_ with ADT instance.

I have to agree with that.

Perhaps it's been said, but one way to look at it is:

	object = ADT + identity + state
	process = object + concurrency

An object might not have identity or state, depending on the
implementation; but then again, a bear might not have arms or legs...
is it not still a bear?  Maybe better would be to say:

	ADT = object - (identity + state)

Obviously both ADT's and objects have encapsulation.  Inheritance is
probably moot here; you could say a Reversible Stack ADT IS-A Stack ADT,
it's just that very few people do.  Polymorphism is probably also moot. 
If all the operations which apply to a Stack also apply to a Reversible
Stack, then those operations are polymorphic, and if they don't, then
they aren't.  It seems to depend completely on just how tightly you
want the operations to be associated with the ADT.

So I think the differences between all these things are pretty minor
(which is sort of implied by the term "-oriented": there's a reason we
don't use terms like "imperative-oriented" or "functional-oriented" to
describe languages)

-Chris



More information about the erlang-questions mailing list