R
Robert Klemme
Mark Hubbart said:I understand that. The attraction would not be that you can just
compile any previously written code, but that you can code something
*new* using the subset, and compile it. The compilable subset (call it
cRuby) wouldn't be competing with Ruby, but C, C++, etc. For most
things, one would still use good 'ol Ruby
What cRuby *would* be useful for:
- Writing shared libraries that people programming in other languages
could use
- Creating multi-platform apps that don't require a Ruby installation
- Avoiding C/C++ at all costs
I can understand why someone would want to do that.
Some projects simply *require* using a compilable language. I have not
yet found a compilable language that is easy and fun to use. cRuby
could fill the gap there.
I see. So someone should start defining the sub set so we can see a bit
clearer where this leads. AFAICS these are not in the subset:
#eval
#instance_eval
#module_eval
Maybe we would want to remove these as well:
#extend
#define_method
From the CLISP manpage:
"Invoked with -c, the specified lisp files are compiled to a bytecode
that can be executed more efficiently."
Btw, I guess this is what - at the moment - Ruby does, too, isn't it?
From my (very limited) experience with it, it doesn't seem that lisp
has an eval statement, so much as lisp *is* an eval statement
Which is the reason for the language subset - within the subset, there
would be no need for including the runtime; it could just be compiled
to machine code.
I'm wondering how much performance that will give us since I am under the
impression that due to the highly dynamic nature of Ruby still a lot of
interpretation has to be done at runtime. Unfortunately we won't know
prior to realization of the Ruby compiler. :-(
The other thing that adds to my scepticism is that there's a general trend
in computer languages towards managed code and VM's (Java, C#, clisp?,
....) and I guess there's a reason for that. Maybe it's better to extend
the Ruby interpreter towards an intelligent runtime system like the Java
VM (or use that as an underlying system if possible).
Back when I was using perl, I checked out their Perl->C project. It
could translate perl code into c code. Problem is, it was trying to
make it so that *any* valid perl code, including evals, could be
translated. A simple "hello world" would get translated into a few
thousand lines of C code.
Apparently they made the -v switch default. )
Kind regards
robert