Change typespec for IO.getn/3 count arg

55 views
Skip to first unread message

eksperimental

unread,
Apr 29, 2016, 2:16:10 PM4/29/16
to elixir-l...@googlegroups.com
I'm currently reviewing the IO module, and I discovered an
inconsistency in a data type.

getn(device, prompt, count)
> last arg. here is pos_integer

binread(device \\ group_leader(), line_or_chars)
> last arg here is non_neg_integer

since getn uses :erlang.get_chars/3
http://erldocs.com/18.3/stdlib/io.html?i=0&search=get_chars#get_chars/2
and that one does accept non_neg_integers as Count arg, I think
IO.getn/3 should be updated accordingly.

We have the special cases of IO.binstream/2 and IO.stream/2 that I
think should be kept as is (count = pos_integer)

José Valim

unread,
Apr 30, 2016, 7:58:02 AM4/30/16
to elixir-l...@googlegroups.com
It is OK as is. The mirror of binread is read, and not, getn. It would be weird to call getn and pass n=0 (given the function name).

eksperimental

unread,
May 3, 2016, 12:26:02 PM5/3/16
to elixir-l...@googlegroups.com
I sent this email 2 days ago, and I just made it now to the list.
And the original email that I sent 3 days ago... never made it ;-(

Are my messages put on moderation list automatically by google?
I notice this happened earlier with other message I sent.

cheers

José Valim

unread,
May 3, 2016, 12:27:04 PM5/3/16
to elixir-l...@googlegroups.com
It is really weird because the moderation e-mails only arrive really late as well. In any case, I have made sure to whitelist your name now. :)



José Valim
Skype: jv.ptec
Founder and Director of R&D


--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/20160430012929.3370d634.eksperimental%40autistici.org.
For more options, visit https://groups.google.com/d/optout.

eksperimental

unread,
May 3, 2016, 5:30:39 PM5/3/16
to elixir-l...@googlegroups.com
thank you José,
I started to worry that google was blocking my mail server for some
reason.


On Tue, 3 May 2016 18:26:42 +0200
José Valim <jose....@plataformatec.com.br> wrote:

> It is really weird because the moderation e-mails only arrive really
> late as well. In any case, I have made sure to whitelist your name
> now. :)
>
>
>
> *José Valim*
Reply all
Reply to author
Forward
0 new messages