Erlang 基本原理(视频) https://erlangcentral.org/erlang-rationale-2/ or (slides) http://www.erlang-factory.com/upload/presentations/329/EFKR10-ErlangRationale.pdf;是一个很好的信息来源,源代码也是user.erl http://github.com/mfoemmel/erlang-otp/tree/master/lib/kernel/src/user.erl#L182.
简而言之:
{io_request, From, ReplyAs, Request}
%From is the process to send the reply to,
%ReplyAs is any term the caller desires to
%match up the request and the response. (returned verbatim in the reply)
{io_reply, ReplyAs, Reply}
user.erl 中的一些请求:
{put_chars, IoList} % puts the iolist
{put_chars, M,F,A} % puts the result of apply(M,F,A)
{get_geometry, 'rows' | 'columns'} % returns the number of rows or columns of the console
{get_line, Prompt} % calls io_lib:collect_line(Prompt)
{get_chars, Prompt, Mod, Func, ExtraArgs}
{get_until, Prompt, Mod, Func, Args}
{setopts, Options} % only option supported by user is 'binary'
% (binary mode if present in Options, list mode otherwise)