From: dblack@... Date: 2006-03-08T23:56:53+09:00 Subject: Re: Having a block executed in the context of an instance Hi -- On Wed, 8 Mar 2006, itsme213 wrote: > > "Mike Austin" wrote > >> Thanks, that works well. But as you note, prepending 'self' kind of >> defeats the purpose ;) Is there a way to make Ruby not create local >> variables, but use 'local var' or similar? Io (www.iolanguage.com) has >> this problem early on and was solved by using := for creating slots, and = >> for updating slots. > > I personally would like some such distinction. I don't having to use > "self.att=" since > (a) one does not use self.method(..) in general > (b) self.method(..) has different privacy rules > (c) self.attr= is an exception to both (a) and (b) > > Ara's > attr(new_val) > works, but > (a) does not read like a setter, and > (b) is against the standard Ruby family of attr.. methods > > I wouldn't hold my breath for := or equivalent :-) I have to say, I've been wondering for many years... is self.x = 1 really *that* bad? It just seems like such a minor thing to me. I certainly wouldn't want to see new punctuation introduced just to avoid it. David -- David A. Black (dblack@wobblini.net) Ruby Power and Light, LLC (http://www.rubypowerandlight.com) "Ruby for Rails" chapters now available from Manning Early Access Program! http://www.manning.com/books/black