6 ms·
I guess what he was meaning is that in Erlang in most cases you can work with strings as iolists. Maybe here you can find a bit better explanation: http://erla
by defun 14y ago
I guess what he was meaning is that in Erlang in most cases you can work with strings as iolists.
Maybe here you can find a bit better explanation:
http://erlang.org/pipermail/erlang-questions/2012-May/066590.html http://erlang.org/pipermail/erlang-questions/2012-May/066590...
- lukego 14y agoRight. This is like the POSIX features writev() and 'struct iovec'. Essentially all of Erlang's binary output primitives are happy to take an iolist/iovec instead of a plain string and this means fewer concatenations and/or system calls. Good feature.
- nivertech 14y agoiolists map nicely to gather-write writev(), but unfortunately there is no Erlang primitives for scatter-read readv()
- jlouis 14y agoThis isn't entirely true, see file:pread/2 for how to do it with a file. We lack a binary:pread/2 though :)
- nivertech 14y agothanks for pointing it out, looks like it will not work with sockets though. Also spec says that it will return list of either strings or binaries, not exactly iolist.
- masklinn 14y ago> Also spec says that it will return list of either strings or binaries, not exactly iolist. It's a proper subset of iolists, since it reads from flat data (a file) there isn't much sense in its adding arbitrary amounts of nesting to it.