From: Chad Fowler Date: 2003-10-03T00:02:04+09:00 Subject: Re: C or C++? On Thu, 2 Oct 2003 dblack@superlink.net wrote: # Hi -- # # On Thu, 2 Oct 2003, Paul William wrote: # # > On Thu, 2003-10-02 at 16:45, Joe Cheng wrote: # > > I'd like to start writing Ruby extensions. Does it make a difference # > # > Why do you want to write extensions? Why cant you write ruby code? # # It's not an either-or choice; lots of Ruby programmers do both. # C extensions are usually written for speed. ...or to integrate with C-based libraries, which I'd say is one of the best reasons to use C in your Ruby development. My process would be: * If it requires a C library, evaluate how difficult it would be to obviate the need for the C library by rewriting the part I need in Ruby (I don't necessarily recommend this, but it's how I am). * If it requires a C library, wrap the C library with a small Ruby extension. * If it doesn't require a C library, try pure Ruby before jumping into a C extension based on the assumption that C is necessary for speed. * If the ruby version is too slow, try to optimize it in Ruby. * If it's not going to be fast enough in Ruby, rewrite the required bits in C as an extension. I'm very C-averse I guess. Chad