Re: [elixir-core:9223] Re: Automatically time long-running iex commands.

2019-10-17 Thread Fernando Tapia Rico

>
> One thing I really like about the automatic message is that it is 
> discoverable. The feature is just there. And we have prior art.


Agreed.

And also agree with Ben Wilson on using the `iex` prefix, but I would 
include the number of the prompt. Here is a mockup:

[image: Screen Shot 2019-10-18 at 08.52.29.png]


If anyone wants to play a bit with it (more spaces, other message, time 
inside the prompt, etc), here is the mockup code: 


IO.puts("\n\niex(9)> :timer.sleep(32_000)\n" <> IO.ANSI.cyan() <> ":ok\n" <> 
IO.ANSI.reset() <> "iex(9) run in 32 seconds\niex(10)> _\n\n")


 

On Friday, October 18, 2019 at 5:22:55 AM UTC+2, Ben Wilson wrote:
>
> I really like this feature idea. Often you don't know or expect that a 
> particular function will take so long, and it's precisely at that point 
> that you go "man, I wish I had timed that". Particularly if the function is 
> doing a side effect, it may be non trivial to try again.
>
> Perhaps if the messaging all happened with the `iex()` prefix it might 
> make more sense where it's coming from?
>
> iex(1)> some_long_fun()
> iex(taking more than 5 seconds ...)
> iex(returned after 15 seconds)
> {:ok, :foo}
> iex(2)>
>
> On Thursday, October 17, 2019 at 8:20:16 PM UTC-4, José Valim wrote:
>>
>> Showing the time every time (and other metadata) would definitely be too 
>> verbose, even inside the prompt. But I understand the origin of the message 
>> being unclear.
>> -- 
>>
>>
>> *José Valim*
>> www.plataformatec.com.br
>> 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-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/c4b48de9-7515-4555-ba61-377af0d0233e%40googlegroups.com.


Re: [elixir-core:9223] Re: Automatically time long-running iex commands.

2019-10-18 Thread José Valim
My suggestion is to show it *before* we show the result, this way I don't
think we need to include the prompt. +1 no some sort of IEx prefix:

iex> long_operation()
[iex] command took 12.1s
%Some.Struct{...]



*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D


On Fri, Oct 18, 2019 at 8:55 AM Fernando Tapia Rico 
wrote:

> One thing I really like about the automatic message is that it is
>> discoverable. The feature is just there. And we have prior art.
>
>
> Agreed.
>
> And also agree with Ben Wilson on using the `iex` prefix, but I would
> include the number of the prompt. Here is a mockup:
>
> [image: Screen Shot 2019-10-18 at 08.52.29.png]
>
>
> If anyone wants to play a bit with it (more spaces, other message, time
> inside the prompt, etc), here is the mockup code:
>
>
> IO.puts("\n\niex(9)> :timer.sleep(32_000)\n" <> IO.ANSI.cyan() <> ":ok\n"
> <> IO.ANSI.reset() <> "iex(9) run in 32 seconds\niex(10)> _\n\n")
>
>
>
>
> On Friday, October 18, 2019 at 5:22:55 AM UTC+2, Ben Wilson wrote:
>>
>> I really like this feature idea. Often you don't know or expect that a
>> particular function will take so long, and it's precisely at that point
>> that you go "man, I wish I had timed that". Particularly if the function is
>> doing a side effect, it may be non trivial to try again.
>>
>> Perhaps if the messaging all happened with the `iex()` prefix it might
>> make more sense where it's coming from?
>>
>> iex(1)> some_long_fun()
>> iex(taking more than 5 seconds ...)
>> iex(returned after 15 seconds)
>> {:ok, :foo}
>> iex(2)>
>>
>> On Thursday, October 17, 2019 at 8:20:16 PM UTC-4, José Valim wrote:
>>>
>>> Showing the time every time (and other metadata) would definitely be too
>>> verbose, even inside the prompt. But I understand the origin of the message
>>> being unclear.
>>> --
>>>
>>>
>>> *José Valim*
>>> www.plataformatec.com.br
>>> 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-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/c4b48de9-7515-4555-ba61-377af0d0233e%40googlegroups.com
> 
> .
>

-- 
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/CAGnRm4JHJUHFcWcNoOV%2BP7ckFzqbEP1y40kp-TT%3DnAHewVJnqA%40mail.gmail.com.