Larry Wall larry-at-wall.org |Perl 6| wrote:
On Fri, May 15, 2009 at 07:16:45PM -0500, John M. Dlugosz wrote:
Reading through S02, I see that contextual variables has changed in the
last year. It appears that contextual and global variables have been
unified. So, the + twigil is no more?
I assume the point is that any supposed "global" can be overridden in
dynamic context, rather than having to know which you planned to and
which you didn't. Normal code should use $*x, not $GLOBAL::x or
whatever.
Is that it, or is there more I need to be filled in on?
That's it, you've nailed it in one. Though perhaps we could mention
here that part of the motivation is to push context info down the
dynamic stack to the point where we minimize shared state between
threads. And also, knowing whether a particular context var is
rw or not means we know whether we can just make a copy into our
current thread with value semantics, or we have to manage a lock
around the shared container. Well, that's the hope...
Larry
Hmm, so being read-only implies it won't change and can be cached
locally, as opposed to "YOU can't change it along this access path".
Don't we have separate readonly and rw variables aliasing the same
underlying value now? I think you're confusing const and volatile.
--John