I think displaying the running time to the right of the result would be 
ideal.

The user will not think it is program output, since it is to the right and 
on the same line as the result.

     iex(14)> :timer.sleep(4000) 
     :ok                                                         4.000s
     iex(15)>

It would also be great if you could see for how long the program has 
already been running when it has not completed yet. If it is technically 
possible, this could be done with updating text on the terminal. The 
'result' line would be immediately visible after starting the command, with 
the return value replaced with three updating dots ('' '.' '..' '...'). And 
the running time updating live to the right.

Before program is done:


     iex(16)> :timer.sleep(4000); IO.puts("[program output]"); 
:timer.sleep(4000)
     [program output]
     ... 
                                                                                
                                                            
6.421s

After it is done:

     iex(16)> :timer.sleep(4000); IO.puts("[program output]"); 
:timer.sleep(4000)
     [program output]
     :ok 
                                                                                
                                                          
8.000s
     iex(17)>         

If live updating text is not an option I don't think intermediate values 
should be printed. It would not be possible to distinguish them reliably 
from program output.

It is always nice if it can be configured as well.

Op vrijdag 18 oktober 2019 11:51:32 UTC+2 schreef Ivan Ivanov:
>
> Is it necessary to have this information on the left? This way both the 
> result from your code and some iex internals will print there, which some 
> people said could be confusing. What if it's on the right?
> Also instead of showing the time it took to run, could iex allow some 
> customization and the execution time could be one of the possibilities?
> For example, my terminal has the datetime on the right, which allows me to 
> measure time, too:
> [image: Screen Shot 2019-10-18 at 12.50.17.png]
>
>
>
>
>
>
>
>
>
> This is done by configuring the right prompt, which is currently not 
> supported by iex: `RPROMPT="[%D{%f/%m/%y}|%*]"`
>
> Doing it *exactly* like this won't allow measuring the time it took but 
> it can be extended.
>
> It can also be useful for other scenarios. An example is tracking timeouts 
> - if you run a task/call with N seconds timeout, it's easy to see that it 
> was started more than N seconds ago just by looking at the datetime of the 
> command that initiated it.
>

-- 
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/de60be41-12b6-4f45-9556-e6e2c5edda5b%40googlegroups.com.

Reply via email to