[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

pre/post question/idea

dblack

11/28/2003 2:33:00 AM

1 Answer

T. Onoma

11/28/2003 3:14:00 AM

0

On Friday 28 November 2003 03:32 am, David A. Black wrote:
> As we're still pre-2.0, and talking about pre and post, I thought I'd
> throw in a bit of possible syntax for this that occurred to me, namely
> this:
>
> 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
>
> which to me has a bit of a "spliced onto the language" feel (which
> perhaps it is, but it would still be nice to avoid that feel :-) I
> like the simplicity and symmetry of separate def/pre/post.

Sorry David, your a little late to make claims on that one. If you read my AOP
RCR (which by the way I think I've plugged like six times now) you would
notice that I offer:

wrap w
super
print "W"
end

as a backup alternative to my primary proposal, which I belive to be a far
superior:

class C
def x
puts "how are you?"
end

def x
puts "hello"
super
puts "goodbye"
end
end

Before anyone looks at this and crys "foul!", read the dang RCR.

http://www.rubygarden.org/ruby?AspectOr...

-t0