[Seaside-dev] Configurable current request context variable

Max Leske maxleske at gmail.com
Wed May 10 19:56:34 UTC 2017


> On 10 May 2017, at 19:55, Esteban A. Maringolo <emaringolo at gmail.com> wrote:
> 
> What are the benefits of an exception based dynamic variable versus a
> process variable?
> 
> It seems to me that the process variable is "cleaner" since it doesn't
> require any exception handler.

Exactly. My main concern, however, is performance. Lookup in the process environment takes constant time, while the lookup time of the exception mechanism depends on the depth of the stack and usually requires traversal of multiple handler contexts. In newer VM’s there’s a primitive to help with that but it’s still slower.

> 
> I'm currently doing Seaside in Cincom Smalltalk and I confirm the
> Process object has an `environment` variable that holds a dictionary
> (and can fallback lookup to a global ProcessEnvironment singleton).

Thanks.

> 
> What I don't understand is how would the subclassing work.
> If WADynamicVariable is suposed to subclass GRDynamicVariable how
> would the platform specific classes play here?

Good point. One way would be to bind the global #WADynamicVariable to a concrete class (e.g. like it has been done in Squeak and Pharo with Transcript or Processor). I don’t like that solution very much. Another could be to have the same class WADynamicVariable defined in multiple packages, i.e., once per platform, where WADynamicVariable implements the platform specific behaviour and inherits from GRDynamicVariable. This solution is better for users but probably a maintenance nightmare.
Another option could be to make WADynamicVariable store a platform specific strategy that is determined dynamically upon load / first use.

I don’t have much experience yet with Seaside and Grease, so I’m hoping that the core maintainers will make the decision for me :) Whatever is implemented, it should probably stay in line with existing platform agnostic solutions used by Grease.


Cheers,
Max


> 
> Regards!
> 
> Esteban A. Maringolo
> 
> 
> 2017-05-10 14:16 GMT-03:00 Max Leske <maxleske at gmail.com>:
>> Good news: VA doesn't have dynamic variables either but their process also has an environment (called #attributes). If there's no other platform to look out for, we could simply replicate the DynamicVariable behaviour for each platform without depending on DynamicVariable. There would only be
>> 
>> GRDynamicVariable
>> ^
>> |
>> WAPharoDynamicVariable / WAVWDynamicVariable / WAVADynamicVariable
>> 
>> They would only differ in the name of the environment and possibly lookup semantics and GRDynamicVariable could hold all of the logic (it would mostly be a copy of DynamicVariable).
>> 
>> Of course, we could also offer the choice between the exception based and process based variants.
>> 
>> What do you think?
>> 
>> Cheers,
>> Max
>> 
>> 
>> 
>>> On 10 May 2017, at 16:44, Philippe Marschall <philippe.marschall at gmail.com> wrote:
>>> 
>>> On Mon, May 8, 2017 at 8:57 AM, Max Leske <maxleske at gmail.com> wrote:
>>>> 
>>>>> On 7 May 2017, at 23:09, Philippe Marschall <philippe.marschall at gmail.com> wrote:
>>>>> In theory we could say that the dialect has to provide a
>>>>> GRDynamicVariable, we could provide a GRExceptionBasedDynamicVariable.
>>>>> Dialects that have a DynamicVariable class could provide
>>>>> GRDynamicVariable as a subclass of DynamicVariable. Dialects that do
>>>>> not have a DynamicVariable class could provide GRDynamicVariable as a
>>>>> subclass of GRExceptionBasedDynamicVariable.
>>>> 
>>>> Yes, that sounds like a good idea. I don't have a clear picture of how your suggestion would be implemented with Grease. So if you could help me out there, I'd appreciated it.
>>> 
>>> It would be sort of a kludge
>>> 
>>> In Pharo we would have
>>> 
>>> DynamicVariable (Pharo)
>>> ^
>>> I
>>> GRDynamicVariable (Grease-Pharo-Core)
>>> ^
>>> I
>>> WADynamicVariable (Seaside-Core)
>>> 
>>> In a dialect without dynamic variables we would have
>>> 
>>> Notification (Dialect)
>>> ^
>>> I
>>> GRExceptionBasedDynamicVariable (Grease-Core)
>>> ^
>>> I
>>> GRDynamicVariable (Grease-Dialect-Core)
>>> ^
>>> I
>>> WADynamicVariable (Seaside-Core)
>>> 
>>> 
>>> Cheers
>>> Philippe
>>> _______________________________________________
>>> seaside-dev mailing list
>>> seaside-dev at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>> 
>> _______________________________________________
>> seaside-dev mailing list
>> seaside-dev at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
> _______________________________________________
> seaside-dev mailing list
> seaside-dev at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev



More information about the seaside-dev mailing list