[MacRuby-devel] Tyro Needs Ruby vs. O-C Advice

Morgan Schweers cyberfox at gmail.com
Wed Mar 30 21:32:45 PDT 2011


Greetings,
Hell, I spend most of my time in Java, and I find the objc verbosity to
be...uhhh...pretty familiar. ;)

Joking aside, I'll often take common ObjC patterns and 're-do' them the Ruby
way so they're more efficient to the way my brain works.

As an example from a recent bit of code, you have:

      NSArray *dropTypes = [NSArray*
*arrayWithObjects:"BookmarkDictionaryListPboardType", "MozURLType",

                               NSFilenamesPboardType, NSURLPboardType,
NSStringPboardType, nil];

versus
      dropTypes = ["BookmarkDictionaryListPboardType", "MozURLType",
NSFilenamesPboardType, NSURLPboardType, NSStringPboardType]

The first is remarkably flexible in rare cases, but exceptionally annoying
for the common case.

To try and answer the questions, though...

   - What are the advantages of MacRuby over Objective-C?
   - An easy to learn, concise syntax in a language designed for the
      pleasure of programming but with enough power for all but the toughest
      problems
      - Being interpreted means you can try things very quickly, and not
      have to go through a compile cycle for each time you just want to see how
      something works.
      - A ton of 'gem' libraries that do very cool things in natural way
   - What are the advantage of O-C over Ruby?
      - Compiled, so marginally faster (although MacRuby's compilation is
      getting better)
      - All the examples of doing MacOS X programming out there are in
      Objective C, so you have to translate
      - A decent number of native libraries which, while you can use them in
      MacRuby, are easier to use in Objective C
      - *iOS programming*
   - Is Xcode's support for O-C significantly better than it's handling of
   Ruby?  Do I care?
   - Yes, it is better.  No, I don't find it better enough that I care very
      much.  Symbol completion doesn't work great in MacRuby, but it doesn't
      bother me much.
   - At this point I'm primarily interested in OS X development, but iOS
   clearly needs to run a close second.  What's the current status of Ruby
   development for iOS and is it likely to go anywhere in the nearish future?
   - The garbage-collection requirement makes this a non-starter right now.
       It might get better, *it might not.*  I do iOS programming in
      Objective C, and Mac OS X programming in MacRuby.  It helps me
keep my hand
      in Objective C development, so I'm always able to translate between
      Objective C and MacRuby, while letting me build a desktop app in
my favorite
      language of all time, so far. :)
   - Any thoughts on the longer-term prospects of either language?
      - Ruby itself is likely to remain a strong contender for many years.
       MacRuby has just started being shipped, albiet as a private
framework, by
      Apple.  This bodes well, but as the Java OS X developers can
tell you with a
      touch of sadness...things change.

Hope that helps some!

--  Morgan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110330/f3109e42/attachment.html>


More information about the MacRuby-devel mailing list