This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1610 - don't environments behave like a stack? why not say so?
Summary: don't environments behave like a stack? why not say so?
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 1.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows 2000
: P2 minor
Target Milestone: ---
Assignee: Jerome Simeon
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-15 00:06 UTC by Fred Zemke
Modified: 2007-01-16 17:28 UTC (History)
0 users

See Also:


Attachments

Description Fred Zemke 2005-07-15 00:06:53 UTC
2.1.4 Notations for environments
It says "Also, note that there are no operations to remove 
entries from environments.  This is never necessary as updating
an environment effectively creates a new extended copy of the
original environment, leaving the original environment 
accessible wherever it is in scope along with the updated copy."
So which copy is used in case of a conflict?  Example:
an outer scope has a variable named $v and an inner scope 
creates a new variable named $v with a different value.  So 
which value is accessed?  I think the truth is that creation of
a new environment completely occludes the old environment,
so it is not true to say that both the old and the new 
environment are accessible.  I think
the behavior is actually a stack, and only the top environment 
on a stack is used.  When the scope that created the top 
environment exits, then that environment is popped from the stack,
bringing the outer environment back into visibility.
I think that expressing the behavior in this fashion would be
both more correct and more understandable.
Comment 1 Jerome Simeon 2005-07-19 16:45:29 UTC
I believe this is editorial.
- Jerome
Comment 2 Mary Fernandez 2006-04-11 22:15:56 UTC
The paragraph immediately following the one below 
already addresses this point:

 <p>Updating an environment creates a copy of the original
      environment and overrides any previous binding that might exist
      for the same name and the same component in that
      environment. Updating the environment is used to capture the
      <emph>scope</emph> of a symbol (e.g., for variables, namespace
      prefixes, etc). For instance, in the following expression</p>