[Oz] Ports need a close operation

Peter Van Roy pvr at info.ucl.ac.be
Mon Feb 12 11:04:24 CET 2001


Dear all,

There is something missing in the Port abstract data type.

The NewPort operation has the following signature:

  {Port.new Xs ?P}

where P is the new port and Xs is a read-only variable that gives
access to the port's stream.  This definition makes it impossible to
close the port (terminate the stream with nil).  For example, when
ports are used as building blocks in concurrent ADTs, it can be
necessary to close them. (For example, I wrote a concurrent version of
Filter that adds elements incrementally to the output without waiting
for previous elements.  This cannot be done with ports unless a close
operation exists.) I suggest extending the NewPort operation with a
Close operation:

  {Port.newClose Xs ?Close ?P}

Here, Close is a zero-argument procedure that when executed
closes the port (terminates Xs with nil and makes further
Send operations impossible).  Close is a capability: it gives the
port's creator, but no-one else, the ability to close the port.

What do you think?

Peter
-
Please send submissions to users at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.





More information about the mozart-users mailing list