[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Wrapping a C Library: Allocation and duplication issues

jbonnar@gmail.com

9/11/2006 7:54:00 PM

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://l...