[erlang-questions] If you could rename ports, what would you call them?

Robert Virding <>
Tue Oct 5 23:17:46 CEST 2010


  I think that if something has process semantics, i.e. behaves like a 
process with asynch messages, exit signals, etc., then it's reference 
should be a pid. This irrespective of how it is started. Even today, 
with "normal" processes you don't have to know how they have been 
started to use them, just which protocol you need to communicate with them.

Ports, of course, are a natural for pids as they already have process 
semantics. ( I won't go into a long tirade about how wrong the docs are 
when claiming that the port_XXXX BIFs have a cleaner and more logical 
behaviour than the message protocol. :-) )

ETS tables are also a natural to be described as pids, it is easy to 
define a message based protocol for them, and they already handle exit 
signals.

The important thing with process "things" is that they HAVE process 
semantics and not HOW it is implemented under the covers. So for 
example, "sending a message" to an ETS pid could very well be 
implemented in a similar fashion as it is today.

There should only be two types of things in Erlang, processes and 
immutable data.

Robert

On 2010-10-05 21.57, Tony Arcieri wrote:
> As I'm building a language which is layered on top of Erlang itself, would
> it make sense to implement TCP sockets as Pids which point to a proxy
> process that actually talks to the socket or ETS table, relegating ports to
> the internal implementation?
>
> On Tue, Oct 5, 2010 at 2:34 AM, Joe Armstrong<>  wrote:
>
>> Pids
>>
>> There shouldn't be ports in the language at all (sorry) - ports should
>> in all circumstances
>> behave and be indistinguishable from Pids.  open_port(...) should
>> return a Pid and not a port.
>>
>> We should reduce the number of concepts in the langauge not increase
>> them - all in the
>> name of conceptual integrity.
>>
>> /Joe
>>
>>
>> On Tue, Oct 5, 2010 at 6:45 AM, Tony Arcieri<>
>> wrote:
>>> I'm working on Reia, a Ruby-like language for the Erlang VM. Reia is an
>>> everything-is-an-object language, and the Erlang core types are all
>> wrapped
>>> as objects.
>>>
>>> As part of this process I've wrapped ports. However, in my opinion port
>> is a
>>> confusing name, particularly when dealing with a TCP port (in the Erlang
>>> sense) which represents a connection to a particular TCP port (in the TCP
>>> sense).
>>>
>>> Because of this sort of ambiguity, I'd like to rename ports. But what's a
>>> good replacement name? Some of the ones I've considered: SysPort, IOPort,
>>> Channel.
>>>
>>> What would you call ports if you had the opportunity to rename them?
>>>
>>> --
>>> Tony Arcieri
>>> Medioh! A Kudelski Brand
>>>
>
>


More information about the erlang-questions mailing list