From: Robert Dober Date: 2006-06-23T18:33:29+09:00 Subject: Re: How odd is Ruby code allowed to be? ------=_Part_19102_15398753.1151055008096 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 6/23/06, Roger Johansson wrote: > > Ok, strange question maybe. > Anyway, Im new to Ruby and I decided to make a small Aop lib just to > learn all the nice things about ruby.. > > so in my lib I can define an aspect like this: > > > class MyAspect < Aspect > apply_to_types SomeClass, String, FooBar > > pointcut("some_method","some_prop=3D","some_prop","length").with( > LoggingInterceptor.new ) > end > Looks like normal code to me, syntax and semantics, not pragmatics. Would this be considered valid in the Ruby world or is this just as > crazy as I think it look? Did you write it? In that case, why did you write it in that way, or the other way round rewrite it differenly and compare. In case you did not, no I do not think it looks crazy. Now switching to the pragmatics you are worried about. The reason I decided to try to make the aspect as a class even though it > isnt intended to be instanciated is that since it inherits my Aspect > base, I get access to my dsl'ish methods in the scope of the class. If you are worried about your design because you do not like the resulting code, I personally, and I might get strong opposition, think that you are o= n the path to perfection. It is a long and winding road, and of course it is assympthotic :( I can then register this class in my Aop engine which extracts the info > out of the static structure. > > So is it valid or just madness? No of course it is not madness, but maybe you should rethink the design and think about David's answer below (sorry if I messed up the posting position ). Cheers Robert //Roger > > -- > Posted via http://www.ruby-forum.com/. > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_19102_15398753.1151055008096--