Is Ruby to Objective-C Source Translator Easier?

G

Gully Foyle

Would it be easier to create a ruby to objective-c translator than it is
to create a ruby compiler? Given the following, it appears it might be
easier to do this than converting ruby to pure c or c++.

Support for blocks in Objective-C described here (its been tested with
POCS, not sure how many other compilers support this):

http://users.pandora.be/stes/block98/index.html


And here's a short description of Objective-C from
http://www.dekorte.com/Objective-C/

C-based

Unlike C++, Objective-C is a true superset of C.

Dynamic

Objective-C is dynamicaly typed so class libraries are much
easier to deal with than in C++. The Objective-C run-time allows you to
access methods and classes by their string names, as well as do dynamic
linking and addition of classes and categories at runtime.

Simple

Unlike C++, Objective-C only extends the C language to support
Smalltalk like OO features without any extra functional-programming baggage.

Elegant

Objective-C supports dynamic binding and has a messaging syntax
like SmallTalk's.

Example:

[myColor setRed:0.0 green:0.5 blue:1.0];

Fast

Objective-C performs dynamicaly bound message calls very quickly
(about 1.5-2.0 times as long as a C function call).
 
L

Lennon Day-Reynolds

It might make more sense to adapt some of the implementation tricks
from POC or the GCC libobjc runtime to get the Ruby runtime overhead
down closer to that of Objective-C. However, in order to get
competitive performance, you're still going to have to either JIT or
inline C code in places; doing runtime method dispatch for operations
on native ints and chars is never going to be as fast as a compiled
version.

Lennon
 
P

Phil Tomson

Would it be easier to create a ruby to objective-c translator than it is
to create a ruby compiler? Given the following, it appears it might be
easier to do this than converting ruby to pure c or c++.

Support for blocks in Objective-C described here (its been tested with
POCS, not sure how many other compilers support this):

http://users.pandora.be/stes/block98/index.html

I could be wrong, but I don't believe that the gcc Objective C compiler
supports this and it is the most widely used compiler for Obj C (and it's
essentially what is used on the Mac platform for compiing Obj C/cocoa).

Phil
 
D

David Ross

--- Gully Foyle said:
Would it be easier to create a ruby to objective-c
translator than it is
to create a ruby compiler?

Easier yes, faster no. I know ObjC very well. If you
program on a MacOSX computer with the GNUstep
libraries, the overhead is HUGE. Decided language is
C. After I get it somewhat stable I will be using
little peephole tricks to make it faster, with asm
most likely. After I get it stable of course. --David
Ross




__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
 
F

Frank Mitchell

Phil said:
I could be wrong, but I don't believe that the gcc Objective C compiler
supports this and it is the most widely used compiler for Obj C (and it's
essentially what is used on the Mac platform for compiing Obj C/cocoa).

You're not wrong. The writer of POC has decided to go his own way with
the Objective-C language, starting with the original Stepstone compiler.
He also reviles Apple's additions since Stepstone at every breath;
check out comp.lang.objective-c for any length of time. So, no matter
how interesting some of his extensions are, you'll never be able to
integrate them with Apple ObjC short of forking his source.

Plus, last time I checked, the GNU runtime is based on a version of
NeXT's runtime *before* they switched to NSObject and the whole NS*
class hierarchy.

So the subset of Objective-C that compiles with GCC, POC, and Apple is
vanishingly small ....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top