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

    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).
    Gully Foyle, Jul 23, 2004
    #1
    1. Advertising

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

    Lennon
    Lennon Day-Reynolds, Jul 24, 2004
    #2
    1. Advertising

  3. Gully Foyle

    Phil Tomson Guest

    In article <UFgMc.2791$>,
    Gully Foyle <> wrote:
    >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
    Phil Tomson, Jul 24, 2004
    #3
  4. Gully Foyle

    David Ross Guest

    --- Gully Foyle <> wrote:
    > 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
    David Ross, Jul 24, 2004
    #4
  5. Phil Tomson wrote:
    > In article <UFgMc.2791$>,
    > Gully Foyle <> wrote:
    >>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).


    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 (fmitchell each acm period org)

    Please avoid sending me Word or PowerPoint attachments.
    See http://www.fsf.org/philosophy/no-word-attachments.html
    Frank Mitchell, Jul 25, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rooban

    C++ to Java source translator

    rooban, Jul 3, 2004, in forum: Java
    Replies:
    3
    Views:
    9,350
    Roedy Green
    Jul 3, 2004
  2. Replies:
    4
    Views:
    175
    Erik Hollensbe
    May 2, 2006
  3. Replies:
    1
    Views:
    185
    Jorgen Grahn
    Oct 9, 2013
  4. Replies:
    0
    Views:
    217
  5. Replies:
    3
    Views:
    96
    CHIN Dihedral
    Apr 17, 2014
Loading...

Share This Page