L Peter Deutsch
437
Seibel: Wouldn’t the Haskell guys come back and say, “Yes, that’s our
monads and the way that it’s clearly differentiated is in the type system?”
Deutsch: You know, I have never understood Haskell monads. I think I
stopped tracking functional languages at ML.
If you look at E—this is not a language that anyone knows about to speak
of—it’s this language which is based on a very strong notion of capability.
It’s related to Hewitt’s actor languages and it’s related to capability-based
operating systems. It has ports, or communication channels, as the
fundamental connection between two objects, the idea being that neither
end of the connection knows what the other end of the connection is. So
this is very different from a pointer, which is uni-directional and where the
entity that holds the pointer has a pretty strong idea what’s at the other end
of it. It’s based on very strong opacity.
My sort of fuzzy first-order idea is that you have a language in which you
have functional computations and you do not have sharing of objects. What
you have is some form of serialized ports. Whenever you want to talk to
something that you only know by reference, it’s part of the basic nature of
the language that you are aware that whatever that thing out there is, it’s
something that’s going to be dealing with multiple sources of
communications and therefore it has to be expected to serialize or arbitrate
or something. There’s no concept of attribute access and certainly no
concept of storing into an attribute.
There are languages in which you have opaque APIs so the implementations
can maintain invariants; it still doesn’t tell you anything about the larger
patterns of communication. For example, one common pattern is, you have
an object, you hand it off to some third party, you tell that third party to do
certain things to it, and then at some point you ask for that object back.
That’s a pattern of sharing. You, the caller, may never have actually given up
all pointers to the object that you handed off. But you agree with yourself
not to make any references through that pointer until that third party has
done whatever you asked them to.
This is a very simple example of a pattern of structuring a program that, if
there were a way to express it linguistically, would help people ensure that
their code was conformant with their intentions.