From: Stefan Lang Date: 2008-11-01T20:54:00+09:00 Subject: Re: How to access to local variables in enclosing scopes? 2008/11/1 Yuh-Ruey Chen : > Replying to multiple posts: > > On Oct 31, 5:19 pm, Stefan Lang > wrote: >> In the end, you'll find out what looks like a big problem now >> actually isn't. The most important usecase for your desired >> scoping rules would be nested functions, and Ruby doesn't >> have them. And for the other use cases, constants, class- >> and module instance variables suffice. OTOH, you can nest >> blocks as much as you like and scoping is what you expect. > > I recognize that access to nonlocal vars can be simulated with > instance variables. Instance variables don't simulate anything. > It does seem weird to allow two different > paradigms that interact with each other in a confusing - or at the > least non-trivial - matter (just look at my confusion). It seems to me you are confused because you are learning by posting questions on mailing lists instead of following some coherent book or introduction material. > I guess my big beef with Ruby is that it is too complex and bloated > with features that often are inconsistent or lack symmetry with each > other. It's too "magical", making it hard to learn exactly how the > language works. From a language design perspective, Ruby really seems > like a mess to me, although with moments of brilliance. Most of the > time, when I'm metaprogramming, I'm guessing and looking at the > output, hoping I got so-and-so quirk correct. Then stop guessing and learn first. Start with Programming Ruby, here's an older version online: http://ruby-doc.org/docs/ProgrammingRuby/ And search ruby-doc.org for more material. Seriously, you sound like you're parroting some preconceived views about Ruby I've seen before from other Python programmers, without even trying to learn. Stefan