2017-01-26 10:59 GMT+01:00 Clément Bera <bera.clem...@gmail.com>: > Let's rewrite the method this way: > > attemptToAssign: value withIndex: index > | process | > "INSERT CODE HERE" > process := Processor activeProcess. > [ process suspendedContext: process suspendedContext sender ] fork. > Processor yield. > self error: 'should not be reached'. > > This way it's clear that execution flow never reaches the end of the > method as the error message is never sent. For some reason in the previous > code by increasing the priority of the process the end of the method could > be reached, as Denis showed, which leaded to incorrect behavior. This is > still hackish and we still need to provide a better way of performing such > returns. > > Any code can be written at the "INSERT CODE HERE" position, including > exception signals, etc. > > Normal methods ends with a return, for example, "^ self". When performed, > "^ self" pushes "self" on the sender's stack and resumes execution in the > sender. In this call-back, when reaching the end of the method, the > sender's execution needs to be resumed, but no value needs to be pushed on > its stack. That's why instead of a normal return I use: > process := Processor activeProcess. > [ process suspendedContext: process suspendedContext sender ] fork. > Processor yield. > I don't know how to explain it better. I understand that because it was > bugged it was very hard to understand. I will put a slice on the bug > tracker. >
Thank's Clement. Now I understand it.