<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello.<br>
<br>
<br>
erlang:open_port/2 has following spec (not related parts are
omitted):<br>
<span class="bold_code"> -spec open_port(PortName, PortSettings)
-> port() when<br>
</span><span class="bold_code"><span class="bold_code">
PortName :: {spawn, Command :: string() | binary()} | ...<br>
<br>
, so Command can be either string() or binary().<br>
<br>
On the other hand, the name of a driver is extracted as follows
(erts/emulator/beam/erl_bif_port.c):<br>
if ((name_buf = erts_convert_filename_to_encoding(name,
NULL, 0, ERTS_ALC_T_TMP,0,1, encoding, NULL, 0))<br>
<br>
The argument 1, before encoding, is an allow_atom flag, so there
is no runtime error when Command being an atom is passed (of
course, if the driver exists).<br>
<br>
Is there a rationale for such limits of Command's type?<br>
For me, it seems logical if Command would have type driver:<br>
driver() = iolist() | atom()<br>
<br>
<br>
</span></span>Dinislam Salikhov<br>
</body>
</html>