From: Mark Slagell Date: 2001-06-01T14:20:55+09:00 Subject: [ruby-talk:16115] Re: Strange idea... exporting from a scope "Hal E. Fulton" spake: > ... > my_method do |x,y,z| > # ... > my_var = 123 # my_var is created here > #... > export :my_var > end > > # Now this scope knows about my_var! > puts my_var # 123 > > This would be a partial solution to the > block problem... since one reason people > pass existing variables into the |...| list is > so that they can retrieve the values after > the block exit. > > The thing exported might or might not be > named in the list. > > Actually, I can't remember the other reasons > right now for passing existing vars in... If it > were earlier, maybe I could. > > Comments and criticisms? vellllly intelesting. "If it were earlier" I might think of a good use for this. At the moment I can't. :-) On the other hand I've been one of those people agitating for the stiffening of block scope boundaries, so to speak, and maybe that explains my lack of imagination. Anyway even ignoring all that, I'm not sure I like the thought that an export could happen from anywhere in the block, and might be more comfortable if I could always look in one place (the top or bottom, I guess) to know what was being exported. But it would probably be nearly impossible to implement that way, at the top at least. -- M