[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: pre/post question/idea

Chad Fowler

11/28/2003 3:47:00 AM

1 Answer

Joey Gibson

11/28/2003 4:00:00 AM

0

On 11/27/2003 10:47 PM, Chad Fowler wrote:

>On Fri, 28 Nov 2003, David A. Black wrote:
>
># class C
># def x
># puts "how are you?"
># end
>#
># pre x
># puts "hello"
># end
>#
># post x
># puts "goodbye"
># end
># end
>#
># It's possible that there are problems with doing it this way that I'm
># not seeing, but personally I like the way it looks better than
>#
># def x:pre
>
>This is excellent. I hope there aren't any gotchas that nobody has
>thought of. You're right about the "splicing" thing. This feels a lot
>more like it's supposed to be a part of Ruby.
>

I much prefer the foo:pre, foo:post way to this. Of course the first
time I saw this (apart from doing AspectJ work in Java) was in Lisp, and
what Matz proposed was lifted straight from Lisp. Using 'pre' and 'post'
as equivalents of 'def' seems a bit of a hack, to me. I think the
foo:pre syntax is more explicit in expressing what you are trying to do
that this.

Joey

--
Never trust a girl with your mother's cow
never let your trousers go falling down in the green grass...

http://www.joeygibso...
http://www.joeygibso.../life/Wisdom.html