S
S.Z.
I am playing with a Synchronized class that automates resource locking
(code snippet can be found here:
http://www.rubygarden.org/ruby?MultiThreading).
One issue arised is how to overload all (or particular) Object's (or
some ancestor's) methods by the automated way?
Syncronized extraction looks like this:
class Syncronized
def initialize( klass, *args )
@obj= klass::new( *args );
end
def to_s() @obj.to_s(); end
# What about clone(), taint(), and other?
end
It is hard work to type all the Objecs's methods by hand in spite of
their bodies are the same.
What is the better choice?
(code snippet can be found here:
http://www.rubygarden.org/ruby?MultiThreading).
One issue arised is how to overload all (or particular) Object's (or
some ancestor's) methods by the automated way?
Syncronized extraction looks like this:
class Syncronized
def initialize( klass, *args )
@obj= klass::new( *args );
end
def to_s() @obj.to_s(); end
# What about clone(), taint(), and other?
end
It is hard work to type all the Objecs's methods by hand in spite of
their bodies are the same.
What is the better choice?