Printing in transcript inside a loop

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Printing in transcript inside a loop

Sebastian Tleye-2
Hi all, 

I want to print in the transcript from inside a loop, the problem I am seeing is that it does not print until the loop is finished. Is it a bug or do I have to configure something?

This is a piece of code to exemplify it

(1 to: 10000) do: [ :i |
Transcript show: i asString.
]

Thanks in advance

By the way, I am using Pharo 3.

--
Sebastián Tleye
Reply | Threaded
Open this post in threaded view
|

Re: Printing in transcript inside a loop

Matthieu
Hello,

You need to fork it to be able to see the updates right away.

An example :

[ 1 to: 100 do: [ :i |
    Transcript show: i asString.
    (Delay forMilliseconds: 20) wait.
] ] fork

Cheers,

Matthieu

2015-06-10 11:48 GMT+02:00 Sebastian Tleye <[hidden email]>:
Hi all, 

I want to print in the transcript from inside a loop, the problem I am seeing is that it does not print until the loop is finished. Is it a bug or do I have to configure something?

This is a piece of code to exemplify it

(1 to: 10000) do: [ :i |
Transcript show: i asString.
]

Thanks in advance

By the way, I am using Pharo 3.

--
Sebastián Tleye

Reply | Threaded
Open this post in threaded view
|

Re: Printing in transcript inside a loop

Sebastian Tleye-2
Ah ok, thank you Mathieu!

2015-06-10 11:56 GMT+02:00 Matthieu Lacaton <[hidden email]>:
Hello,

You need to fork it to be able to see the updates right away.

An example :

[ 1 to: 100 do: [ :i |
    Transcript show: i asString.
    (Delay forMilliseconds: 20) wait.
] ] fork

Cheers,

Matthieu

2015-06-10 11:48 GMT+02:00 Sebastian Tleye <[hidden email]>:
Hi all, 

I want to print in the transcript from inside a loop, the problem I am seeing is that it does not print until the loop is finished. Is it a bug or do I have to configure something?

This is a piece of code to exemplify it

(1 to: 10000) do: [ :i |
Transcript show: i asString.
]

Thanks in advance

By the way, I am using Pharo 3.

--
Sebastián Tleye




--
Sebastián Tleye
Reply | Threaded
Open this post in threaded view
|

Re: Printing in transcript inside a loop

philippeback
In reply to this post by Matthieu


On Wed, Jun 10, 2015 at 11:56 AM, Matthieu Lacaton <[hidden email]> wrote:
Hello,

You need to fork it to be able to see the updates right away.

Or ask for the world to happen if the code is in the UI thread.

World doOneCycle


Phil
 

An example :

[ 1 to: 100 do: [ :i |
    Transcript show: i asString.
    (Delay forMilliseconds: 20) wait.
] ] fork

Cheers,

Matthieu

2015-06-10 11:48 GMT+02:00 Sebastian Tleye <[hidden email]>:
Hi all, 

I want to print in the transcript from inside a loop, the problem I am seeing is that it does not print until the loop is finished. Is it a bug or do I have to configure something?

This is a piece of code to exemplify it

(1 to: 10000) do: [ :i |
Transcript show: i asString.
]

Thanks in advance

By the way, I am using Pharo 3.

--
Sebastián Tleye