From: Gavin Kistner Date: 2005-05-17T23:02:01+09:00 Subject: Re: Help regarding def wrapper --Apple-Mail-5-592337278 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed On May 17, 2005, at 7:52 AM, Nikolai Weibull wrote: > I=E2=80=99d like to have a def that I can scope in one go, i.e., > > class A > scoped_def :private, :a do > =E2=8B=AE > end > end What do you prefer about the above, versus the existing (and, IMO, =20 slightly prettier): class A private; def meth1( arg1, arg2=3D:foo ) 'private' end protected; def meth2( arg1, arg2=3D'bar' ) 'protected' end public; def meth2( arg1, arg2 ) 'public' end end With your technique, you cannot declare default values for arguments, =20= correct? (At least, not in blocks in 1.8) And while the above syntax that I wrote is close to yours, I further =20 personally prefer using the public/protected/private items as they =20 were intended, to denote blocks of methods in my class which are =20 each, visually grouping like-scoped methods. class A def public1; ...; end def public2; ...; end protected def protected1; ...; end def protected2; ...; end private def private1; ...; end def private2; ...; end end That simply makes more sense, to me personally. --Apple-Mail-5-592337278--