Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support :stdio and :stderr as IO arguments #318

Closed
josevalim opened this issue May 31, 2012 · 2 comments
Closed

Support :stdio and :stderr as IO arguments #318

josevalim opened this issue May 31, 2012 · 2 comments
Milestone

Comments

@josevalim
Copy link
Member

@alco
Copy link
Member

alco commented Jun 13, 2012

How do you see this implemented? Using a macro to convert the device argument or using a macro for defining functions in the IO module? I imagine something along the following lines:

  def read(device // :stdio, count) do
    Erlang.io.get_chars(map_device(device), "", count)
  end

  defmacrop map_device(dev) do
    case dev do
      :stdio -> :standard_io;
      :stderr -> :standard_error;
      _ -> :standard_io;
    end
  end

@josevalim
Copy link
Member Author

Exactly this, but the _ -> should return whatever was given as parameter. :)

Sent from my iPhone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants