T
Trans
I was looking at Matz' Wild and Weird ideas [1]. He talks about
annotations at one point and gives this example:
# @require: arg1 >= 10
# @overriding: true
# @visibility: public
def foo(arg1)
...
end
I'm not too keen on using comments like this. It separates the
annotations from ordinary code, thwarting the great dynamic nature of
Ruby. Perhaps autovivify class level methods with a syntax like call
instance vars could be used instead:
@foo require: lambda { arg1 >= 10 }
overriding: true,
visibility: public
That way they could be used any where, even encapsulated and reused.
T.
[1] http://www.rubyist.net/~matz/slides/rc2005/index.html
annotations at one point and gives this example:
# @require: arg1 >= 10
# @overriding: true
# @visibility: public
def foo(arg1)
...
end
I'm not too keen on using comments like this. It separates the
annotations from ordinary code, thwarting the great dynamic nature of
Ruby. Perhaps autovivify class level methods with a syntax like call
instance vars could be used instead:
@foo require: lambda { arg1 >= 10 }
overriding: true,
visibility: public
That way they could be used any where, even encapsulated and reused.
T.
[1] http://www.rubyist.net/~matz/slides/rc2005/index.html