Adding access to outer scopes to DynamicVariable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding access to outer scopes to DynamicVariable

marcel.taeumel
Hi, there.

Please find attached the addition of outer-scope access to DynamicVariable. Any thoughts on performance and programming interface?

I would like to add it to trunk in the next week. :-)

Best,
Marcel



DynamicVariable.st (7K) Download Attachment
ProcessSpecificTest.st (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Adding access to outer scopes to DynamicVariable

Frank Shearar-3
Just one: DynamicVariable is incompatible with stack operations (*). Delimited dynamic variables are what you want, and they're in a package on SqueakMap - http://map.squeak.org/package/00e786be-3742-4976-be5b-ddfb6b51aeda.

(*)  http://okmij.org/ftp/Computation/dynamic-binding.html#DDBinding digs into why that is - the tl;dr is "because there are multiple incompatible possible sensible ways of combining dynamic binding and dynamic control (stack operations), there are no sensible ways of combining the two".

frank

On Thu, 18 Apr 2019 at 05:41, Marcel Taeumel <[hidden email]> wrote:
Hi, there.

Please find attached the addition of outer-scope access to DynamicVariable. Any thoughts on performance and programming interface?

I would like to add it to trunk in the next week. :-)

Best,
Marcel



Reply | Threaded
Open this post in threaded view
|

Re: Adding access to outer scopes to DynamicVariable

Jakob Reschke
In reply to this post by marcel.taeumel
Hi,

I'm curious about the requirement for this. Is it for debugging/inspection purposes? Because I think regular application code should not try to access outer scope values of a dynamic variable. Much like it should not access any arguments of method contexts further up the call stack.

Kind regards,
Jakob

Am Do., 18. Apr. 2019 um 14:42 Uhr schrieb Marcel Taeumel <[hidden email]>:
Hi, there.

Please find attached the addition of outer-scope access to DynamicVariable. Any thoughts on performance and programming interface?

I would like to add it to trunk in the next week. :-)

Best,
Marcel



Reply | Threaded
Open this post in threaded view
|

Re: Adding access to outer scopes to DynamicVariable

marcel.taeumel
Hi Jakob,

I want to implement a dynamic lookup mechanism using dictionaries that are bound via a dynamic variable. Due to subclassing DynamicVariable using a proper name, such outer-scope access will be modular and maintainable in this scenario. I think that one would not consider this as "regular application code" but rather "meta-stuff in a framework". :-)

Hi Frank,

would it make sense to add those delimited dynamic variables to trunk?

Best,
Marcel

Am 21.04.2019 22:48:18 schrieb Jakob Reschke <[hidden email]>:

Hi,

I'm curious about the requirement for this. Is it for debugging/inspection purposes? Because I think regular application code should not try to access outer scope values of a dynamic variable. Much like it should not access any arguments of method contexts further up the call stack.

Kind regards,
Jakob

Am Do., 18. Apr. 2019 um 14:42 Uhr schrieb Marcel Taeumel <[hidden email]>:
Hi, there.

Please find attached the addition of outer-scope access to DynamicVariable. Any thoughts on performance and programming interface?

I would like to add it to trunk in the next week. :-)

Best,
Marcel



Reply | Threaded
Open this post in threaded view
|

Re: Adding access to outer scopes to DynamicVariable

timrowledge
I'd prefer to prevent any such 'outer scope variable' stuff. We have this mechanism for handling getting information from places - message sends.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: HSJ: Hop, Skip and Jump



Reply | Threaded
Open this post in threaded view
|

Re: Adding access to outer scopes to DynamicVariable

Frank Shearar-3
Tim's reply kind've broke the thread but anyhoo: it is of course all message sends; the problem is finding the right thing to which to send a message. If the target of your message is meant to be something dynamically scoped then delimited dynamic variables are the tool for the job.

I only didn't push Control into trunk because I was also pushing for kernel minification. Seemed a bit hypocritical.

Levante I'm sure will point out that delimited dynamic variables are expensive - they're implemented using reasonable exceptions after all. Yes they are. They also actually work, unlike the current DynamicVariable which, like Scala's implementation, doesn't behave sensibly after a stack splice.

frank

On Tue., Apr. 23, 2019, 17:58 tim Rowledge, <[hidden email]> wrote:
I'd prefer to prevent any such 'outer scope variable' stuff. We have this mechanism for handling getting information from places - message sends.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: HSJ: Hop, Skip and Jump