Hi all,

I've recently stumbled across the .editor feature in Node.js' REPL. It sets 
the REPL in to editor mode, which allows for easily inputting (or pasting) 
multi-line code into the REPL. 
With iex, one of its shortcoming is its treatment of the pipe operator. If 
I want to paste code such as

value
|> fun1()
|> fun2()

into iex I must first rewrite it into

value |> fun1() |> fun2()

As the former is usually the preferred style of writing piped expressions, 
this means that whenever I want to try out code from a project that 
contains any such expression I must first manually reformat it. With a 
functionality such as the .editor mode this could be elegantly avoided.

With the help of a macro this might be easily added, for example, as part 
of IEx.Helpers. If we had a macro `e` defined as

defmacro e(do: block) do
  quote do unquote(block) end
end

then `e` would become an editor mode like call in iex. For example, I could 
now write

iex> e do
...> 1..5
...> |> Enum.map(fn x -> x + 1 end)
...> end
[2,3,4,5,6]

allowing me to easily paste more complex expressions including pipes in new 
lines into iex.

Looking forward for feedback and comments.

Regards
Arno




-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/6611b3ce-0cbd-4e40-b212-a880e7a0f8ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to