On Thu, 30 Jan 2003, Paul Brannan wrote:

> In C, "if" doesn't introduce a new scope; {} does:
>
> void foo() {
>   int x = 1;
>   if(1)
>     int x = 2; // error: redeclaration of x
>   if(1) {
>     int x = 2; // okay; the outer x is hidden by this one
>   }
> }

this is precisely why i don't like that in

  arr.each { |elem|
    max = ...
  }
max could be in the global scope - i'm a C programmer and this simply seems
bizarre.

now

  arr.each { |elem|
    keyword max = ...
  }

where keyword is something like 'static' or 'export' implying that the var is
on the heap and globally available make sense to me.

-a

-- 

 ====================================
 | Ara Howard
 | NOAA Forecast Systems Laboratory
 | Information and Technology Services
 | Data Systems Group
 | R/FST 325 Broadway
 | Boulder, CO 80305-3328
 | Email: ahoward / fsl.noaa.gov
 | Phone:  303-497-7238
 | Fax:    303-497-7259
 ====================================