On Thu, 30 Jan 2003, Ryan Pavlik wrote:

> OK, this may seem an odd set of quotes, but I have a question.  What
> happens when you do this:
>
>    def munge(a)
>       a.each {
>          | i |
>          export x;
>          x = x + i
>       }
>
>       p x
>    end
>
> ..and 'a' is empty?  'x' never happens.

'export x'

    should be a compile time directive so 'x' always happens

> Now, you say that Quote 2 would be exactly identical to Quote 3, but
> it seems to me that it would be largely painful to search through
> scopes to make sure you catch all initializations:
>
>    def quux()
>       proc {
>          export x;
>
>          proc {
>             export y;
>
>             proc {
>                export z;
>             }
>          }
>       }
>    end

again, because it would be compile time this would read as in

  def quux()
     x = nil
     proc {
        y = nil
	proc {
           z = nil
	   proc {
	   }
	}
     }
  end

thus the scoping rules at runtime would be exactly the same.

> First of course is the question which scope each fall into (you said
> "local" scope so I assume #quux-wide), and then you'd have to make
> ruby hunt through all your blocks.  Then what happens if you pass one
> as a parameter... where do exports go then? ;)

lost me here.

> Plus, there's the most important consideration:
>
> x = nil
> export x
>        ^--- One extra character to type!

i made that same argument recently myself in anther thread/topic.  it is the
convincing one IMHO!

i must point out here that the distinction between compile time and runtime in
ruby is a murky subject, at best, in my mind.  perhaps would i suggest is
impossible, but it seems like it might be if export was a compile time
directive, like alias.

-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
 ====================================