Dennis Decker Jensen wrote:
> 
> "Guy N. Hurst" wrote :
> [A good summa summarum of discussed features]
> 
> > However, it make ruby look somewhat declarative.
> > Yet think about private, public, attr, and the like.
> > Plus, think about the certainty it would afford, and
> > the time saved.
> 
> "The time saved" implies time saved when writing libraries - right?
> The small Nuby don't need to worry about this before he throws himself
> out into the ocean of the RAA....
> 

Actually, I meant the time saved from having to figure out
what other variables have already been used or might be affected.

> > Conceptually,
> > {|params, shadows~| <imports|exports> .... }
> >
> > iterators work, closures work; optional extra control...
> 
> *  Params are as usual. Shadows are also params, but with localized
> changes to values from variables in the enclosing scope.

and shadow vars are always block-local in scope so 
as to not interfere with the outer scope

> *  Imports are like shadows, but they aren't params (from a yield
> statement i.e.). 

yes, in that imports always create block-locals with an
initial value obtained from the enclosing (outer) scope.

> If they don't exist in the external scope, they get
> created and initialized.

Do you mean created an initialized in the external scope? 
Then no...this is what exports would do.

Imports have no effect on the external scope. They look there
for a value to use for initializing themselves, and if they
do not find it they initialize themselves to nil.

> *  Exports are like imports, except that they are visible after the
> exit to the enclosing scope (non-localized changes).

No, actually, exports are the way to make sure block-local variables
are shared with the outer scope. They ensure there is a local variable 
in the outer scope matching the value of the block-local. 
It is the opposite of an import.

> *  There is no "native" block-local variables. 

No, but it can be simulated with imports. Just manually
initialize it right after it is imported:

foo {|x|<a|> a=0; .... }


> The extra control is
> optional.
> 

right

> Is my understanding correct?
> 

I tried clarifying above... did I succeed? :-)

In short, shadows and imports are analogous in providing
block-local variables with an initial value obtained from
the outer scope (if available), and exports do the reverse
by creating/overwriting a local variable in the outer scope.


Guy N. Hurst


-- 
HurstLinks Web Development    http://www.hurstlinks.com/
Norfolk, VA  23510            (757)623-9688 FAX 623-0433
PHP/MySQL - Ruby/Perl - HTML/Javascript