[erlang-questions] input too fast

Fredrik Svahn fredrik.svahn@REDACTED
Mon Jul 2 21:13:48 CEST 2007


On 7/2/07, Bengt Kleberg <bengt.kleberg@REDACTED> wrote:
>
> On 2007-06-29 14:45, Fredrik Svahn wrote:
> ...deleted
> > fileio()->
> >     {ok,StdIn}=file:open("<stdin>",[raw, binary, read]),
> >     {ok,StdOut}=file:open("<stdout>",[raw, binary, write]),
>
> minor detail: somebody might want to call a file <stdin> (not impossible
> imho) and therefore it could be better to use an atom in this case.
>
> ie, string is file name, atom is one of stdin, stdout, stderr.


While I agree that "<stdin>" seems to be a perfectly valid (although not
recommended) filename in all(?) unix systems I do not think that using an
atom will help. file:open/2 can already take an atom as filename argument
according to the docs. Thus the following commands are all vaild and will
return usable IoDevices

1> {ok, File1}=file:open("hello.erl",[read]).
2> {ok, File2}=file:open('hello.erl',[read]).
3> {ok, File3}=file:open(hosts,[read]).
4> {ok, File4}=file:open(stdin,[read]).

Changing this would unfortunately not be backwards compatible. Maybe Ulfs
suggested solution with back pressure is better after all...

/F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070702/04be497f/attachment.htm>


More information about the erlang-questions mailing list