<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-12-16 22:06 GMT+01:00 Nicolai Hess <span dir="ltr"><<a href="mailto:nicolaihess@gmail.com" target="_blank">nicolaihess@gmail.com</a>></span>:<br><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><div class="gmail-h5"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-12-15 14:46 GMT+01:00 Nicolai Hess <span dir="ltr"><<a href="mailto:nicolaihess@gmail.com" target="_blank">nicolaihess@gmail.com</a>></span>:<br><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><div><div><div><div><div><div><div><div><div><div><div>Hi,<br><br></div>anyone knows the seaside example from the pharo by example book:<br><br>SBE2-SeasideRPN-on.1<br><br>MCSqueaksourceRepository<br>    location: '<a href="http://www.squeaksource.com/SqueakByExample" target="_blank">http://www.squeaksource.com/S<wbr>queakByExample</a>'<br>    user: ''<br>    password: ''<br><br></div>I can not get it to work. On Seaside 3.0 you need to change the class initialization,<br></div>because the application registration had changed.<br></div>But despite that, the calculator does not work. Everytime I push on a number<br></div>I get a empty-collection-error.<br></div>I don't understand why, because the rendering of the calculator stack <br></div>calls a method ensureStackMachineNotEmpty, that puts a 0 onto the stack.<br></div>Now, pushing a keypad button for a number, will pop this element and convert both<br></div>the existing number and the new number to a new number.<br></div>But somehow the stack is empty, eventhough we call ensureStackMachineNotEmpty.<br><br></div>Anyone has experience with this example or can find out what is wrong ?<br></div><div>I don't have much experience with seaside.<br><br></div>thanks in advance.<br></div>
</blockquote></div><br></div></div></div><div class="gmail_extra">Ah, on seaside 3.0 the current (initial state) of the StackMachine is saved once before the rendering (WASnapshot), and if we modify the stack machine state (the OrderedCollection)<br></div><div class="gmail_extra">during #renderContentsOn:, the prior state (with the empty stack) is restored before executing the callbacks. <br></div><div class="gmail_extra">This had changed, in seaside 2.8, saving the state snapshots happens first after the initial rendering.<br></div><div class="gmail_extra">Was this change on purpose ? Is there some information about, when it is  allowed to modify the state during rendering ?<br></div><div class="gmail_extra"><br>I guess we may have to make sure that any state changes are happening outside of the rendering, is there some ~pattern~ to follow, when it is save to change states ?<br><br></div><div class="gmail_extra">thanks in advance<span class="gmail-HOEnZb"><font color="#888888"><br><br></font></span></div><span class="gmail-HOEnZb"><font color="#888888"><div class="gmail_extra">nicolai<br></div><div class="gmail_extra"><br></div></font></span></div>
</blockquote></div><br><br></div><div class="gmail_extra">Ok I found a hint in <a href="http://book.seaside.st/book/fundamentals/anchors/about-callbacks">http://book.seaside.st/book/fundamentals/anchors/about-callbacks</a><br></div><div class="gmail_extra">"Important : Do not change state while rendering....."<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Ok, so the old RPNCalculator example does not work anymore if we try to "ensure the stack is not empty" during then renderContentsOn: method.<br></div><div class="gmail_extra">Now I need to find a way to ensure the stackmachine non-emptyness before doing the rendering.<br></div><div class="gmail_extra"><br>Is there a hook, called before the rendering, that *can* change the component state ?<br><br></div><div class="gmail_extra"><br></div></div>