Hi there
it is either and probably just me being stupid (label as bug and wontfix ) or just maybe it’s a bug in Elixir
iex(21)> filen
"/home/robert/tmp/file1"
iex(22)> File.open(filen, [:write], fn f -> IO.puts(f, ["hello", [" ", ["world"]]]) end)
{:ok, :ok}
iex(23)> File.read! filen
"hello world\n"
looks good to me, however
iex(24)> File.open(:stdio, [:write], fn f -> IO.puts(f, ["hello", [" ", ["world"]]]) end)
** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1
The following arguments were given to IO.chardata_to_string/1:
# 1
:stdio
Attempted function clauses (showing 2 out of 2):
def chardata_to_string(string) when is_binary(string)
def chardata_to_string(list) when is_list(list)
(elixir 1.10.3) lib/io.ex:572: IO.chardata_to_string/1
(elixir 1.10.3) lib/file.ex:1381: File.open/2
(elixir 1.10.3) lib/file.ex:1414: File.open/3
Could be normal although slightly unpratical behavior, however:
iex(24)> IO.puts(:stdio, ["hello", [" ", ["world"]]])
hello world
:ok
And yes, I forgot
Erlang/OTP 23 [erts-11.0.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Interactive Elixir (1.10.4) - press Ctrl+C to exit (type h() ENTER for help)
So what did just happen in iex(24)
?
Help’s appreciated
KR
Robert