From: Martin DeMello Date: 2003-01-30T23:01:59+09:00 Subject: Re: Local variables & blocks ahoward wrote: > On Wed, 29 Jan 2003, Martin DeMello wrote: > >> Yes, but my point was, when doing this, I usually have either object >> being an instance variable, or object being assigned shortly before I do >> the call, or object being one of the args to the current method. > > 'shortly' is subjective though : > > require 'tons_of_stuff' > object = 42 > > is this 'shortly'. alot of namespace polluting could have happened during the > require... But method-level scoping still works as before, so I don't see the problem. >> In the first case, you wouldn't use @object as a block temp variable >> anyway. > > why not? why would you want an instance variable to be scoped to a block? > but i'm with you on not wanting to do this > > x = nil > loop { > x = ... > } > > thing all the time. however, that really seems like the ONLY time one > want to 'export' variables isn't it? Pretty much, yeah. But in Ruby, with everything contained in methods and classes anyway, I tend not to bother so much about the global namespace. If one had to distinguish by wa of keywords, I'd rather see a 'local' keyword than an 'export'. martin