From: dblack@... Date: 2007-09-11T21:03:23+09:00 Subject: Re: Bug in lambda? --1926193751-1012482009-1189512197=:9810 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-1012482009-1189512197=:9810" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-1012482009-1189512197=:9810 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Tue, 11 Sep 2007, Pe=F1a, Botp wrote: > Arggh, the scary part is you wont even know if you've been shot > until you're dead --too late. I myself do not like block args (or > any args for that matter) clobbering local, global, and instance > vars. Surely, it is not the intent of the programmer to clobber > them, nor is it an intuitive intent to peek on arg values from the > outside (is that being obj-oriented?). I clobber what i clobber. > When coding an arg var, surely i do not need to bother and question > myself "will this var clobber other vars?". Ruby should help me on > that, not put fear on it. I wonder what is the original intent of > matz when he designed that feature. It is scary. I've been hit by > it. And now i have to be careful about naming my vars. Is that bad? :-) > Is shadowing > arg vars really used much in practice? It is not a fun part of ruby > if you ask me. or maybe, it is just too much fun for me. forgive the > non-ruby-hacker, pls :( But you always have to avoid clobbering variables: x =3D 1 ... ... x =3D gets ... if x > 0 # blows up I think the only hurdle is just realizing that: {|x| ... } is an assignment to x. After that, it's no more dangerous or error-prone than any other occasion when you have to choose a name for a temporary (or not) variable and assign to it. David --=20 * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com) --1926193751-1012482009-1189512197=:9810-- --1926193751-1012482009-1189512197=:9810--