E&S CVS Commit: Contextual - Implement better scoping, by allowing states to be context managers.

pje at eby-sarna.com pje at eby-sarna.com
Sat Mar 3 12:41:06 EST 2007


Author: pje
Date: Sat Mar  3 12:41:05 2007
New Revision: 2297

URL: http://svn.eby-sarna.com?rev=2297&view=rev
Log:
Implement better scoping, by allowing states to be context managers.
Also, renamed setting->value and parameter->expression.  Expressions
scan be scoped to services, such that a "resource" is just an
"Action.expression" (i.e. an expression scoped to the nearest Action
service).  Instead of using 'with service_instance:', you now use
'with service_class.new():' to replace a service.

The next refactoring will change keys from being functions, to being
objects, allowing them to be set to either values or expressions
dynamically.  As a side-effect, this will drop the dependencies to
both the SymbolType and ProxyTypes packages, although that's not the
reason for doing it.  The real reason is that it will allow things
like this::

    with context.new():
        some_var  <<  some_value
        other_var <<= lambda:some_expression
        # code that uses these variables

as the canonical way to set variables in a context. 

Modified:
    Contextual/Contextual.txt
    Contextual/README.txt
    Contextual/context_tests.txt
    Contextual/peak/context.py




More information about the source-changes mailing list