[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ant-dev
Subject:    "Local" properties
From:       Phil Weighill Smith <phil.weighill-smith () volantis ! com>
Date:       2005-06-28 13:24:46
Message-ID: 1119965086.22319.34.camel () c-pweighill-smith ! uk ! volantis ! com
[Download RAW message or body]

I was thinking about "local" properties, having read the discussions
relating to these in the last few months.

Perhaps we could introduce the concept of "property scopes" instead.

The project would provide a standard "global" property scope by default.
It would also provide the ability to push and pop new property scopes
(i.e. manage a stack of scopes). When a property is defined it goes into
the current property scope (unless specifically allowed to be set in the
"global" scope; see my export concept below for an example).

When looking up a property, the property is looked for in widening scope
(i.e. from top to bottom of the scope stack) until it is found or we
have traversed the stack of property scopes all the way up to the
"global" scope and found nothing.

We could then provide any or all of:

      * "<startPropertyScope/>" and "<endPropertyScope/>" tasks (not my
        favorite idea as these can be unbalanced, I prefer the
        following).
      * a "createPropertyScope" attribute on target and/or "sequential"
        and "parallel" tasks or a special "<propertyScope/>" task based
        on "sequential"
      * allow scopes to be automatically managed in macrodefs to avoid
        the need for special syntax for macro parameters (they can be
        properties in a new scope).
      * an "<export property="name" global="boolean"/>" task to promote
        a named property up one scope or into the global scope as
        required (understanding that export will not modify any existing
        property with the same name in the target scope; it might also
        be possible to provide a means of this exporting properties from
        a sub-ant execution to the calling ant execution...?). An
        alternative is to name scopes and allow export to promote a
        property to the named scope, with "default" or "global" being
        the name of the "global" (initial) scope.

All existing behaviour (and therefore BC) can be retained through the
Project API and the "default" settings for any new attributes
introduced.

What do people think?

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic