andymatuschak.org: Asides

This article was published on Wednesday, December 12th, 2007 at 10:58 pm.

RubyCocoa Parses Multiple Return Values!

RubyCocoa parses Cocoa methods that return multiple values through pointer parameters! Check it out:

>> NSWorkspace.sharedWorkspace.getFileSystemInfoForPath_
isRemovable_isWritable_isUnmountable_description_
type_("/Volumes/SparkleCaster/English.lproj")
=> [true, 1, 0, 1, #<NSCFString "hfs">, #<NSCFString "hfs">]

Now we’ve just got to do something about that really ugly method name…

The Conversation {2 comments}

  1. Chris Ryland 13 December, 07 @ 6:23 am

    I think there’s always going to be a disconnect between non-Objective-C interfaces to Cocoa for exactly this reason (the message-passing syntax). You can paper over it with dictionary-style name/value mapping, etc., but it’ll never be as good as the original.

    That’s why I’m off designing a new dynamic language that exactly matches Objective-C’s syntax & general semantics… ;-)

  2. Andy Matuschak 13 December, 07 @ 10:58 am

    Ohman, another one? :)

    I like Nu in theory, but native arrays and hashes are important to me and, well, I find myself having a lot of trouble keeping a sense of scope in big s-exprs.

    But yeah, there will always be some level of disconnect. Unless… maybe Ruby 2.0’s named parameters will help.

Leave a Comment

Currently you have JavaScript disabled. In order to post comments, please make sure JavaScript and Cookies are enabled, and reload the page.

You can follow any responses to this entry via its RSS comments feed. You can also leave a trackback if the inclination is there.

If you're looking for something specific then give the search form below a try:

RSS Wordpress Grady (theme) Return to the Top ↑