From: Robert Klemme Date: 2008-10-29T16:51:48+09:00 Subject: Re: automatic code conversion from Ruby to C ? 2008/10/29 Mohit Sindhwani : >> thank you all for your responses. >> Actually, choosing what the code I'll have to deliver is written in has to >> be C/C++, since the >> customers here want something they can feed into gcc and understand when >> they read it. >> I am not absolutely sure, but I don't think they know Ruby very well and >> probably aren't willing to consider its >> use in this problem, because of the speed issue. > > I find that sometimes customers don't appreciate a new tool/ device - they > like to stay with what they know best... which is fine. My advice to you > would be to prototype in Ruby if there is an element of uncertainty in the > program you're developing. Once the customer sees it working, they may be > convinced. On the other hand, once it's already in Ruby, translating to C/ > C++ isn't that far a step... even if you do it manually. The only problem > is that you need to maintain updates by hand (or update only one or the > other). Given the size of the problem (i.e. small) and the fact that existing C library code has to be used I would directly do this in C or C++. There is also the advantage of not having a hybrid solution which makes certain things easier (building, distribution, code protection etc.). IMHO implementing the parsing of such a simple language ("P1...") is not worthwhile doing this in Ruby. It's always about tradeoffs and forcing Ruby (or any other tool for that matter) into a project where it does not fit will not bring any advantage (rather the opposite). > If you're using C++, hashes can be translated into STL Maps if you need > it... though anything C/C++ is going to be more strongly typed than the duck > typing in Ruby. Note though that Ruby is as strongly typed as C++ - the difference is between "static" and "dynamic" typing. Kind regards robert -- remember.guy do |as, often| as.you_can - without end