Ruby is cool, but I don't want to use it for anything I am likely to
install on a user's machine because (1) I often don't want users to
muck with my code, and (2) sometimes I don't want them to (easily) see
my code. I know that C#/Java can easily be reverse engineered, but
knowing that someone would have to go to such lengths to get to my code
is enough of a barrier to make me want to use one of those languages
over Ruby even though I have to write three times as much code for the
same task.
Don't get me wrong, I love Ruby, I'm not a troll. I'm porting a site
to Rails...so I have a strong predisposition to advocate Ruby for all
things server-side. I just want to be able to use Ruby in the space
where compiled languages tend to travel better than interpreted. I
want to use Ruby for everything and would if I could just get byte
compilation.
-
ed
> I know this has been discussed before but I would like to know if
> anything has changed in the past 2 years and if anything is on the
> horizon that would allow either byte compilation of Ruby (like Python)
> or <dreaming> native compilation </dreaming>.
Have you checked out YARV? See http://www.atdot.net/yarv/ for details...
> Ruby is cool, but I don't want to use it for anything I am likely to
> install on a user's machine because (1) I often don't want users to
> muck with my code, and (2) sometimes I don't want them to (easily) see
> my code. I know that C#/Java can easily be reverse engineered, but
> knowing that someone would have to go to such lengths to get to my
> code
> is enough of a barrier to make me want to use one of those languages
> over Ruby even though I have to write three times as much code for the
> same task.
I know this isn't exactly what you asked for, but if you just need a
minor deterrent, perhaps a hack along the lines of http://
www.rubyquiz.com/quiz34.html would work. Just a thought.
James Edward Gray II
Ruby 2.0 will be byte compiled. Take a look at YARV.
This will be the VM for Ruby 2.0, Matz has already declared.
There's always rubyscript2exe:
http://www.erikveen.dds.nl/rubyscript2exe/index.html
It's not a "real compiler", but it bundles up everything into a
single executable which is certainly more convenient to deploy.
-mental
OK, things are heating up.
It sounds like the Gabmit Scheme approach. Will 'yarv' output ansi C
which we can then run through a C compiler of our choice?
Are there any gcc front ends planned?
Thanks for your post, this is fantastic news.
-
e
> I know this has been discussed before but I would like to know if
> anything has changed in the past 2 years and if anything is on the
> horizon that would allow either byte compilation of Ruby (like Python)
> or <dreaming> native compilation </dreaming>.
>
> Ruby is cool, but I don't want to use it for anything I am likely to
> install on a user's machine because (1) I often don't want users to
> muck with my code, and (2) sometimes I don't want them to (easily) see
> my code. I know that C#/Java can easily be reverse engineered, but
> knowing that someone would have to go to such lengths to get to my
> code
> is enough of a barrier to make me want to use one of those languages
> over Ruby even though I have to write three times as much code for the
> same task.
ZenObfuscator can compile a Ruby program to C.
It has not been released.
--
Eric Hodel - drb...@segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
I wouldn't be to euphoric. I don't think it will be ever possible
to convert a Ruby program to C code that doesn't depend on a Ruby
interpreter.
Extreme example: eval
If it would be possible, Ruby were just C with different syntax.
Regards,
Stefan
yes, AFAIK, the ruby->c translation just spits out a C library that you
can use in your code to get a great speedup (and some obfuscation).
Anyway, I think it would be possible to avoid depending on an
interpreter, following the same approach other compilers for dynamic
languages do: depend on a library (just like libruby) and compile it
directly in the executable.
You might want to check out the 'ruby2c' project. It is still in beta-land,
but with it you could at least translate some ruby that you write into C
code, and then run that in combination with standard ruby.
http://rubyforge.org/projects/ruby2c/
(disclaimer: I have not tried ruby2c, I just think it is an interesting and
worthwhile project)
--
Garance Alistair Drosehn = dro...@gmail.com
Senior Systems Programmer or g...@FreeBSD.org
Rensselaer Polytechnic Institute; Troy, NY; USA
Has anyone analyzed the pros and cons of these two approaches?
--
Dean Wampler
http://www.aspectprogramming.com
http://www.newaspects.com
http://www.contract4j.org
I think that there asre still issues for a ruby interpreter running on
top of the jvm (I'm thinking of HotSpot here) or any other VM designed
for static languages, since some ruby features would run suboptimally on
it.
Think for example of IronPython: it runs faster than CPython on the .net
VM (CLR,which is similar to the jvm) for some benchmarks, and this is a
great goal.
But it is still tens of times slower than C# on the same runtime, since
the VM does not provide mechanisms aimed at optimizing a language like
python (or ruby).
Anyway it is worth noting that SUN seem to be thinking of fixing some of
the issues, see for example the news about a new opcode "invokedynamic"
which is specifically thought to speed up dispatch in dynamically typed
languages.