From: Josh Cheek Date: 2010-05-08T05:10:55+09:00 Subject: Re: ease of porting (translating) ruby to C (vs. python)? --0016e649ce46f26c4c048606a7ba Content-Type: text/plain; charset=ISO-8859-1 On Fri, May 7, 2010 at 11:20 AM, bwv549 wrote: > In a very small bioinformatics group I know of, they are deciding > whether to code mostly in python or ruby. The lead knows that python > can "easily be ported to C because of its strictness." > > How easy is it to port (translate) ruby code into C? Anyone with > experience in doing this? I've done a little and it seemed very easy, > but I've never translated python into C so I can't compare. > > Discussion on alternatives (Inline, using C extensions, NArray, > #include ruby, etc.) is welcome, but I'd like to keep the main focus > on translating to C for this thread. > > Thanks in advance! > > Hi. I don't know about "translating" Ruby into C, I would probably write in C to begin with so that you don't get side tracked using some nice functionality that Ruby provides that C does not. However, Ruby does support a procedural paradigm, and you can write it exactly like your C code (this is how I started, but I don't think it provides any real benefits, I only used it b/c Ruby doesn't care how large your numbers are, and I needed to work with enormously large numbers) I don't know your reasons for wanting to use C, I assume for optimizing certain parts of your algorithm, or dealing with certian low level functionalities. In this case, if you are using the default Ruby (Matz's Ruby Interpreter, which is written in C), then you might consider Ruby-Inline, which is an elegant and powerful library written by Ryan Davis. You can see a few examples here http://www.zenspider.com/ZSS/Products/RubyInline/ It allows you to write your C code directly inside of your Ruby code. Then you can have a nice amalgamate of both Ruby and C, depending on what the situation requires. --0016e649ce46f26c4c048606a7ba--