From: Mike Austin Date: 2006-03-09T01:28:41+09:00 Subject: Re: Having a block executed in the context of an instance rmagick@gmail.com wrote: > dblack@wobblini.net wrote: > >> 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. > > +1 It may be a minor syntax thing, but I think it creates unnecessary ambiguity. If there is a method called caption=(), I expect it to use that. I don't write 'self' anywhere else in Ruby, so it just seems odd. Plus is helps reduce hard to debug locals creation by misspellings. class Button attr :caption, true def initialize(*args, &block) instance_eval &block end end button = Button.new do var :x caption = 'Click Me' end There is already 'attr' for classes, why not 'local' or 'var' for methods? One issue is that you can't assign and declare on the same line. It could be done with a hash but that might look funny? Take this all with a grain of salt. I'm always looking for different ways of doing things. I.e. to find good ideas you have to find bad ideas ;) Mike