<div dir="ltr"><div dir="ltr">Am Mi., 15. Jan. 2020 um 09:13 Uhr schrieb Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</a>>:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div id="gmail-m_2847815226910863130divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<div id="gmail-m_2847815226910863130divtagdefaultwrapper" dir="ltr">
<p style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:12pt"><span style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt">You proposed using a promise - I never had the pleasure to meet them until today. Maybe you have a minimum working example for demonstrating your proposal? FutureNodes seem to be used very rarely in Trunk :-)</span></p></div></div></div></blockquote><div>I have no minimum example ready, but here is the outline:</div><div>- Add an instance variable for the promise to the model.</div><div>- Initialize with `Promise new` when the model is asked to open a view.</div><div>- Answer the promise to the open message.</div><div>- In the model's method that is invoked when the dialog is accepted, promise resolveWith: theResultOfWhatHappened</div><div>- In the method that opens the tool, take the promise and use whenResolved:, whenRejected: (handle the outcome) or then:ifRejected: (handle the outcome and answer another promise -- chaining). Do not attempt to return from the handler blocks, the method will have returned by the time they are evaluated.</div><div><br></div><div>Of course it is a totally different style of programming than with modal windows.</div><div><br></div><div>Similar alternative without promises:</div><div>- Instead of a promise, store a MessageSend in the model.</div><div>- In the client of the model, store all necessary state to continue in instance variables.</div><div>- Do not expect a return value from opening the view for the model.</div><div>- Have the model send the message to self upon continuation.</div></div></div>