"stepping" a non-morphic object

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

"stepping" a non-morphic object

caw
I have a model which needs to run at regular intervals, and it could have a number of UI connections. So it's not "intrinsically" a morph.

What is the best way to get the step message sent to non-morphs - or is there a better way in Pharo

(Google was not my friend!)

thanks in advance for any help

Chris

Reply | Threaded
Open this post in threaded view
|

Re: "stepping" a non-morphic object

LogiqueWerks
re : Google'd heartbeat and model ticking-over

isn't there a stackoverflow.com option for #pharo in addition to this mail list ( when time interval very short ;-) ?  I think Seaside suggests just using #pharo tag to raise someone ... or was that IRC freenode ?

Even with Pharo3 sooo close to release, those EU folks must sleep sometimes ;-)


On 29 April 2014 09:06, Chris Wright <[hidden email]> wrote:
I have a model which needs to run at regular intervals, and it could have a number of UI connections. So it's not "intrinsically" a morph.

What is the best way to get the step message sent to non-morphs - or is there a better way in Pharo

(Google was not my friend!)

thanks in advance for any help

Chris


Reply | Threaded
Open this post in threaded view
|

Re: "stepping" a non-morphic object

Marcus Denker-4

On 29 Apr 2014, at 14:22, Robert Shiplett <[hidden email]> wrote:

re : Google'd heartbeat and model ticking-over

isn't there a stackoverflow.com option for #pharo in addition to this mail list ( when time interval very short ;-) ?  I think Seaside suggests just using #pharo tag to raise someone ... or was that IRC freenode ?




Marcus

Reply | Threaded
Open this post in threaded view
|

Re: "stepping" a non-morphic object

Sean P. DeNigris
Administrator
In reply to this post by caw
Chris Wright wrote
What is the best way to get the step message sent to non-morphs - or is
there a better way in Pharo
I'm not sure I understand exactly, but if you want to do it via Morphic stepping, you could implement e.g. ModelTickingMorph which is invisible and has no extent, and steps your model in it's #step.

or you could use a process:
[ [ myModelObject step. 1 second asDelay wait ] repeat ] fork.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: "stepping" a non-morphic object

Igor Stasenko

On 29 April 2014 18:41, Sean P. DeNigris <[hidden email]> wrote:
Chris Wright wrote
> What is the best way to get the step message sent to non-morphs - or is
> there a better way in Pharo

I'm not sure I understand exactly, but if you want to do it via Morphic
stepping, you could implement e.g. ModelTickingMorph which is invisible and
has no extent, and steps your model in it's #step.

or you could use a process:
[ [ myModelObject step. 1 second asDelay wait ] repeat ] fork.

except that you then will be also responsible for managing forked process
by implementing it.. else it will loop forever, your object will never be GCed,
consume CPU & waste memory :)
oh.. and each time you test it once more, it will readily spawn another process with same characteristics :)



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/stepping-a-non-morphic-object-tp4756998p4757081.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.




--
Best regards,
Igor Stasenko.
Reply | Threaded
Open this post in threaded view
|

Re: "stepping" a non-morphic object

Sean P. DeNigris
Administrator
Igor Stasenko wrote
except that you then will be also responsible for managing forked process
Yes, I left that out for simplicity, but I recall painfully how complex it can be to make sure everything gets GC-ed (http://forum.world.st/Terminating-a-Process-when-an-object-dies-td4683036.html)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: "stepping" a non-morphic object

Ben Coman
In reply to this post by Igor Stasenko
Igor Stasenko wrote:

On 29 April 2014 18:41, Sean P. DeNigris <[hidden email]> wrote:
Chris Wright wrote
> What is the best way to get the step message sent to non-morphs - or is
> there a better way in Pharo

I'm not sure I understand exactly, but if you want to do it via Morphic
stepping, you could implement e.g. ModelTickingMorph which is invisible and
has no extent, and steps your model in it's #step.

or you could use a process:
[ [ myModelObject step. 1 second asDelay wait ] repeat ] fork.

except that you then will be also responsible for managing forked process
by implementing it.. else it will loop forever, your object will never be GCed,
consume CPU & waste memory :)
oh.. and each time you test it once more, it will readily spawn another process with same characteristics :)

Maybe there should be a SystemStepper / Cron object that can be registered on.
cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: "stepping" a non-morphic object

NorbertHartl
There is the Scheduler project on smalltalkhub.

Norbert

Am 30.04.2014 um 05:30 schrieb Ben Coman <[hidden email]>:

Igor Stasenko wrote:

On 29 April 2014 18:41, Sean P. DeNigris <[hidden email]> wrote:
Chris Wright wrote
> What is the best way to get the step message sent to non-morphs - or is
> there a better way in Pharo

I'm not sure I understand exactly, but if you want to do it via Morphic
stepping, you could implement e.g. ModelTickingMorph which is invisible and
has no extent, and steps your model in it's #step.

or you could use a process:
[ [ myModelObject step. 1 second asDelay wait ] repeat ] fork.

except that you then will be also responsible for managing forked process
by implementing it.. else it will loop forever, your object will never be GCed,
consume CPU & waste memory :)
oh.. and each time you test it once more, it will readily spawn another process with same characteristics :)

Maybe there should be a SystemStepper / Cron object that can be registered on.
cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: "stepping" a non-morphic object

EstebanLM
it works fine, I’m using it for some projects. 
and is also in configurations browser :)

Esteban

On 30 Apr 2014, at 09:50, Norbert Hartl <[hidden email]> wrote:

There is the Scheduler project on smalltalkhub.

Norbert

Am 30.04.2014 um 05:30 schrieb Ben Coman <[hidden email]>:

Igor Stasenko wrote:

On 29 April 2014 18:41, Sean P. DeNigris <[hidden email]> wrote:
Chris Wright wrote
> What is the best way to get the step message sent to non-morphs - or is
> there a better way in Pharo

I'm not sure I understand exactly, but if you want to do it via Morphic
stepping, you could implement e.g. ModelTickingMorph which is invisible and
has no extent, and steps your model in it's #step.

or you could use a process:
[ [ myModelObject step. 1 second asDelay wait ] repeat ] fork.

except that you then will be also responsible for managing forked process
by implementing it.. else it will loop forever, your object will never be GCed,
consume CPU & waste memory :)
oh.. and each time you test it once more, it will readily spawn another process with same characteristics :)

Maybe there should be a SystemStepper / Cron object that can be registered on.
cheers -ben


Reply | Threaded
Open this post in threaded view
|

Re: "stepping" a non-morphic object

Sean P. DeNigris
Administrator
EstebanLM wrote
it works fine, I’m using it for some projects.
+1
Cheers,
Sean