Robert Klemme wrote:

>
>But wouldn't it bettern then to implement it in C (or use an existing
>implementation)?  I mean, C *is* portable.
>
>Cheers
>
>    robert
>  
>

Very true.  Generally, C *is* portable, and in general, such things 
should be (and are) written in C.  However, C is *not* portable when a 
module is not available as a pre-compiled binary for a particular 
platform, and the user does not have access to a C compiler (or is not a 
programmer and is not confident compiling their own module).  In such 
cases, the value of simply dropping the module into the Ruby path is 
quite high.

Please don't misunderstand me.  I am not saying that every C module ever 
written for Ruby should have been written *in* Ruby.  That would be 
ludicrous.  I'm simply saying that for some things (compression 
algorithms, for instance), there is some value in having them available 
*both* as a C modules, *and* as pure Ruby modules.

Consider the case of self-extracting Ruby modules.  You simply 
distribute the pure-ruby version of the compression library with your 
own code, and then anyone can extract your module, without having to go 
through some (potentially elaborate) installation scheme.  Before I 
finally broke down and installed both wxWindows and FOX, I would avoid 
programs that used them because I've always found it to be a pain to 
install those systems (partly because, in addition to the systems 
themselves,  you then had to install bindings for your language of 
choice).  (Until I started using Gentoo, anyway, but that's beside the 
point.)

Anyway, I hope that has clarified my position.  I'm not trying to start 
a flame war on the merits of C modules versus pure Ruby modules (or even 
wxWindows and FOX--those were just examples from my own personal 
experience), so please don't be too vehement with any opposing opinions. :)

-- 
Jamis Buck
jgb3 / email.byu.edu

ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'