In article <418D7482.6070909 / neurogami.com>,
James Britt  <jamesUNDERBARb / neurogami.com> wrote:
>David G. Andersen wrote:
>
>
>What's the criteria for having Ruby include something written in C?

This is a good question.

>
>Some issues I can think of for deciding to include C code:
>
>  * License: Code would need to be compatible with/equivalent to
>    Ruby's license
>  * Flexibility/Access: Pure-Ruby libs are available for metaprogramming;
>    I can, in the REXML example, dynamically munge the workings of the
>    parser, something that might vanish were parts replaced with C
>  * Compilation: Adding more C ups the chance that someone, somewhere,
>    will not be able to build Ruby on some platform.  Or move it to Rite.

That's why I like the approach of having a pure-Ruby option.  In general 
various pacakges are usually written first in Ruby (for example the Matrix 
class) and then later on someone finds the need for a faster implementation and 
implements various speed critical methods in C (as was the case earlier in this 
thread where someone posted some Ruby/C code for matrix multiplication).  

The Matrix module could be changed so that an optional C code version is 
require'd - if that require fails, then no problem, you've still got the pure 
Ruby implementation.  It'll be slow but it will work.  If the require 
of the shared library containing the Ruby/C implementation succeeds, 
then you've replaced some speed-critical methods in the class/module with 
faster C implementations of those methods.

Phil