dblack / wobblini.net wrote:
> Hi --
> 
> On Tue, 9 Jan 2007, Charles Oliver Nutter wrote:
> 
>> Evan Phoenix wrote:
>>> Of course methods need local variables, but blocks would have local 
>>> variables still, just all in the scope of their defining method. Why 
>>> do closures need to have their own, unique variables outside of the 
>>> scope that they enclose? Smalltalk gets along quite well with all 
>>> blocks sharing the same local variable scope. The current scope rules 
>>> are a problem for a lot of new ruby programmers. Lots of them see the 
>>> current behavior as a bug that they have to work around.
>>
>> Evan and I discussed this at length on IRC and I came up with one area 
>> that could be damaged by a "flat local scope": DSLs
>>
>> In a large script using a complicated DSL, you would have to make sure 
>> all variables were named independently. Even worse, future revisions 
>> to that script would have to continue to maintain unique variable 
>> names across the entire script.
> 
> I'm not quite following this.  How does a script that defines a DSL
> differ from one that doesn't, in terms of scoping needs?

Just size, I think. Consider a very long rakefile. Having so many blocks 
is unusual in "normal" ruby code.

-- 
        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407