Denis' idea is good.

There is one problem with the implementation of jump though.

MyClass>>iv
iv := 1.
[ 2 ] value.
1halt.

MyClass new
beReadOnlyObject ;
iv

When reaching the halt we see there is an extra nil on stack.

I think this is better than the process hack, at least until we add VM
support for this case.

On Thu, Jan 26, 2017 at 11:36 AM, Denis Kudriashov <dionisi...@gmail.com>
wrote:

>
> 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'.
>>
>
> I guess I found simplest solution to problem. Instead of process logic we
> can just use "thisContext sender jump".
>
> attemptToAssign: value withIndex: index
>         | process |
>   thisContext sender jump.
>   self error: 'should not be reached'.
>
> In my tests it works correctly. I use this method:
>
> ValueHolder>>contents2: anObject
>
> | result |
>
> result := (contents := anObject).
> self halt.
> ^result printString.
>
>
> So debugger is opened at halt. And #result var contains anObject.
>

Reply via email to