From: "Ara.T.Howard" Date: 2005-07-19T04:20:54+09:00 Subject: Re: What does this construct mean? On Tue, 19 Jul 2005, Charles Steinman wrote: > > Ara.T.Howard wrote: >> the best reason is the example you posted - one can make methods which read >> like syntax additions/declarations. the built-in >> >> class C >> attr_accessor 'a' >> end >> >> which (just in case you didn't know) automatically generate accessor methods >> for C objects as in >> >> obj = C::new >> obj.a = 42 >> p obj.a #=> 42 >> >> and this reads really nicely. another good reason to ignore parens is for >> boolean methods like >> >> if array.emtpy? >> array << 42 >> end >> >> i think most would agree that this looks better than >> >> if array.emtpy?() > > Or even worse if array is gotten through an accessor, in which case > you'd have "if array().empty?()", which is just rancid. amen brother. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | My religion is very simple. My religion is kindness. | --Tenzin Gyatso ===============================================================================