Context should expose removed/added scope objects (dicts)
|Reported by:||(removed)||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Originally suggested it in the 'ForNode multiple args' thread, but opening a ticket for it now since it's generally useful.
Basically, proposing that Context.(push|update) return the newly added scope, and that Context.pop() returns the removed scope (for reasons of API symmetry mainly). The main reasoning behind this is that it's useful to bypass Context when doing more then setting a key or two- Context's api isn't as full featured as dicts (nor necessarily should it be).
Right now, can do similar tricks via passing in the new scope to update, but that's not particularly friendly/obvious- alternative being reaching into the Context internal stack, which again, isn't very friendly (screws encapsulation anyways). Bypassing context for doing scope updates is actually fairly useful- very least, access to .clear() is a nice way to avoid continual pop/push on the stack per iteration.
Change History (4)
Changed 9 years ago by (removed)
comment:1 Changed 9 years ago by SmileyChris
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed
comment:2 Changed 9 years ago by jacob
- Triage Stage changed from Design decision needed to Ready for checkin