|Think about Loose Coupling|
Re: MOPT-03 - identification, part 1by djantzen (Priest)
|on Dec 27, 2002 at 04:49 UTC||Need Help??|
Poor ascii art follows, but I found it helpful to map this out a little bit (pls /msg me if the formatting appears munged):
Scope is created by the abstraction barrier insofar as variables and functions defined within the entity itself are inaccessible without, i.e., a lexical variable within a subroutine is accessible only within that subroutine, not to the caller or to other subroutines called from within that unit of encapsulation.
An identifier or name is bound insofar as it merely points to an entity, whereas a name refers if it points across the abstraction barrier to a specific value or summary of the entity.
To dereference is to pull a value or summary across the abstraction barrier to access it directly (or step across the barrier to it, which I guess is an equivalent metaphor), so my $array_ref = [qw/foo bar/] puts the array itself safely behind the barrier, making $array_ref a violation of encapsulation. Instead, we must say $array_ref-> to cross the boundary. Actually, now that I think about this, talking about Perl references muddies the water, doesn't it? Rather, we just mean the use of any variable which results in a taking-hold of the value referenced. So, a better example might just be ordinary string interpolation.
I suppose that means then that a closure is a way of exposing a scoped variable without bringing it across the abstraction barrier.
I'm still confused about what a summary/value is though. Could you provide a concrete example? Also, does object permanence mean "the same entity" in terms of memory location or content? From the discussion, I'm thinking it's the latter. Or maybe that's just the difference between the entity and it's summary?
In any case, great write up; IMHO the best so far!