Am 23.06.2014 um 14:03 schrieb Sven Van Caekenberghe <s...@stfx.eu>:

> Your analysis is correct: DynamicVariables are hard to impossible to debug, 
> the debugger always runs in another process. I don't think there is a 
> solution here (maybe let the debugger process copy/share the binding ?) apart 
> from what you suggest: make sure you enter the debugger after the lookup and 
> assignment of the value to a local variable.
> 
>  server := ZnCurrentServer value.
> 
> Still, I find DynamicVariables very useful, especially 
> architecture/design-wise.

Agreed, I find context sensitive programming important because I don't like 
global state and you can solve this particular problem very easy. But I like 
the exception based dynamic variable much more. There the dynamic value is 
stored in a MethodContext which is a proper place for it. A process being only 
a runtime decorator for a stack is asking for trouble. Everything that 
copies/references the stack is suspect to produce errors. Of course the process 
variables are a lot faster. Don't know if a hybrid solution could work here. 

Norbert

> 
> On 23 Jun 2014, at 13:50, Norbert Hartl <norb...@hartl.name> wrote:
> 
>> In my code I'm using a DynamicVariable to request a context object when 
>> needed. Until now I knew the name DynamicVariable only from seaside. There 
>> it is called WADynamicVariable and it is an exception. So I blindly assumed 
>> the pharo DynamicVariable works the same.
>> I thought this might be a good optimization not to travel the stack all the 
>> time but put in the process. 
>> Now that I am using it I can see the difference. I find it real hard using 
>> it because I don't know how to debug/step in code. DynamicVariable is a 
>> process specific variable but as soon as a debugger opens it is very likely 
>> to be in another process. This makes stepping in method using the 
>> DynamicVariable impossible. The only way round is to set break points after 
>> the dynamic lookup and step from there. But this feels just wrong.
>> What would be the best way to have DynamicVariable and be able to debug 
>> anything? Or is there a variant that uses the stack instead of the "active" 
>> process?
>> 
>> thanks,
>> 
>> Norbert
> 
> 


Reply via email to