Is there a real thing that can convert ruby scripts to c cod

Dear all,
As I read ruby’s code, I think it is possible to convert ruby
scripts to c codes. But I searched on www.rubyforge.org, and got two
tools which do not do real convertion. By real convertion, I mean to use
c like “extend ruby with c”.
The benifits, I think, are more easily interacting with libs writen
by c, especially something like glib or qt. And more stable, e.g.
rcairo, is very unstable.

Thanks.

Magicloud M. wrote:

Dear all,
As I read ruby’s code, I think it is possible to convert ruby
scripts to c codes. But I searched on www.rubyforge.org, and got two
tools which do not do real convertion. By real convertion, I mean to use
c like “extend ruby with c”.
The benifits, I think, are more easily interacting with libs writen
by c, especially something like glib or qt. And more stable, e.g.
rcairo, is very unstable.

Thanks.

I think that this would be an immense and thankless task. If you were
to write code that was near C in syntax it might be easier.

e.g.

for i in 0…10 do
puts ‘blah’
end

but when it is

“5”.to_i.times do
puts ‘blah’ #note the different quotation marks used interchangably
end

it is more cryptic. Add the oddities of hashing and the like and the
task becomes HUGE and thankless.

In short, do not expect to see one anytime soon.

Magicloud M. wrote:

Dear all,
As I read ruby’s code, I think it is possible to convert ruby
scripts to c codes. But I searched on www.rubyforge.org, and got two
tools which do not do real convertion. By real convertion, I mean to use
c like “extend ruby with c”.
The benifits, I think, are more easily interacting with libs writen
by c, especially something like glib or qt. And more stable, e.g.
rcairo, is very unstable.

Do you mean something like this:

http://www.onlamp.com/pub/a/onlamp/2004/11/18/extending_ruby.html

or this:

http://www.rubyinside.com/how-to-create-a-ruby-extension-in-c-in-under-5-minutes-100.html

I do not know how accurate this is - but maybe this gives you a start.

Stefan

Isn’t there ruby2c by zenspider?

Kyle S. wrote:

Isn’t there ruby2c by zenspider?

Yes, that is almost what I wanted, but RubyToC is not complete now, many
things that does not support…