From: Charles Oliver Nutter Date: 2007-09-05T00:03:59+09:00 Subject: Re: python-style decorators Keith Rarick wrote: > I'd love to hear feedback about this library! If you have any comments > or questions, please let me know. Depending on how you've implemented it, the declarative style is not thread-safe. You would need to ensure that the decorators are only aggregated in the current thread, rather than in the class/metaclass for example, since they would step on each other in the latter case. This is because aggregating decorators and eventually applying them to some syntactic construct is not atomic; things can happen between each aggregation and the eventual consumption. The imperative version would be safer, since it could largely be made atomic. I like the idea in general though. I proposed (and roughly implemented) something similar for JRuby to be able to compile to static Java signatures, while still providing fully dynamic bodies: class Foo signature [String, Fixnum] def bar(a, b) ... end end This would compile to foo(RubyString a, RubyFixnum b) with appropriate type checks and conversions, allowing us to provide a real Java method signature. In JRuby, this would be implemented on a per-thread-basis, or we'd use the imperative version: signature :bar, [String, Fixnum] - Charlie