Is Ruby to Objective-C Source Translator Easier?

Discussion in 'Ruby' started by Gully Foyle, Jul 23, 2004.

  1. Gully Foyle

    Gully Foyle Guest

    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):

    And here's a short description of Objective-C from


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


    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.


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


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


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


    Objective-C performs dynamicaly bound message calls very quickly
    (about 1.5-2.0 times as long as a C function call).
    Gully Foyle, Jul 23, 2004
    1. Advertisements

  2. 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

    Lennon Day-Reynolds, Jul 24, 2004
    1. Advertisements

  3. Gully Foyle

    Phil Tomson Guest

    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 Tomson, Jul 24, 2004
  4. Gully Foyle

    David Ross Guest

    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

    Do you Yahoo!?
    Take Yahoo! Mail with you! Get it on your mobile phone.
    David Ross, Jul 24, 2004
  5. 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 ....
    Frank Mitchell, Jul 25, 2004
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.