J
jbonnar
I'm writing a wrapper for a C library [1] written in a very object
orientated style. Since C isn't an OO language, it uses conventions
instead. All of the "classes" are created with a librdf_new_classname
method which acts almost the same as Ruby's Class#new.
The problem I'm having is cleanly separating allocation from
initialization. Since most of the class construction functions require
arguments to initialize the object, I can't define separate alloc and
initialize functions.
The only option I see is to use Ruby 1.6 style code and define a
Klass.new method for my classes, but how should Klass#clone and
Klass#dup methods be written that take into account object freezing,
taint, etc?
Thanks,
Justin
[1] http://librdf.org/
orientated style. Since C isn't an OO language, it uses conventions
instead. All of the "classes" are created with a librdf_new_classname
method which acts almost the same as Ruby's Class#new.
The problem I'm having is cleanly separating allocation from
initialization. Since most of the class construction functions require
arguments to initialize the object, I can't define separate alloc and
initialize functions.
The only option I see is to use Ruby 1.6 style code and define a
Klass.new method for my classes, but how should Klass#clone and
Klass#dup methods be written that take into account object freezing,
taint, etc?
Thanks,
Justin
[1] http://librdf.org/