[erlang-questions] jinterface

Serge Aleynikov <>
Thu Oct 9 05:58:26 CEST 2008


Robert Virding wrote:
> Yes, it is easy to get around this, but no it is not. The io module was
> designed to send the formatting computations to the io-server to be done
> there. The group leader is an io-server as well as being group leader (see
> my Erlang Rationale for a bit better explanation). As I see it you have the
> following options:
> 
> - Do not use io:fwrite or other formatting io calls directly but instead do
> io:put_chars(io_lib:fwrite(Fmt, Args)) instead. This ensures that only an
> iolist is sent to the group leader.

This would be quite limiting as I cannot control nested functions (that 
may have io calls) that are being called by functions executed via RPC.

> - Modify io.erl to do this for automatically for you and use this private
> version. This is not difficult and should cause no other problems.

I think this is the most convenient option out of the three.  What was 
the rationale of having the io server do the formatting as opposed to 
the node generating the io output request?  Was it to decrease the 
possible load on the evaluating node?

> - Modify your program so that you start a local group leader/io-server which
> does the formatting and just send the output iolists to the otp.net process.

The otp.net node already has a mailbox for getting messages destined to 
the io_server, and rpc requests carry the pid of that mailbox.  Ideally 
I wouldn't need to have another "proxy" io_server on the Erlang side 
that would format and send requests to the connected otp.net hidden node.

> Do you do any input from otp.net? 

What I did as far as the input was concerned - I wrote a parser of 
Erlang terms that took a string (such as "M:F(Arg1, Arg2, ...)" from the 
otp.net's stdin or a UI text box, converted it to an AST corresponding 
to a valid Erlang term in external term format, and did an RPC call to a 
connected Erlang node.

Though, the purpose of this exercise was not to compete with werl, but 
rather offer RPC (and optional shell-like capabilities) to a rich UI 
client interface.

Serge



More information about the erlang-questions mailing list