Sometimes in an application, you have an expensive calculation to do, and you would like it to run in the background. However, it's often much nicer to just be able to write a simple method and return a value:
myExpensiveMethod
| expensiveAnswer |
expensiveAnswer := self doExpensiveThing here.
^expensiveAnswer.
Well, you need a background process, but then it needs to pause the one in the foreground, right? And you need to run this in the background so that it doesn't consume all available CPU (especially important in server apps). That's the topic of today's Smalltalk Daily - using class Promise.
Technorati Tags:
smalltalk, process model