[MacRuby-devel] [MacRuby] #254: Let void-returning ObjC calls return the receiver.
MacRuby
ruby-noreply at macosforge.org
Sat May 16 11:59:23 PDT 2009
#254: Let void-returning ObjC calls return the receiver.
--------------------------------+-------------------------------------------
Reporter: mikael@… | Owner: lsansonetti@…
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: MacRuby | Keywords:
--------------------------------+-------------------------------------------
A lot of Objective-C methods return void, especially within Cocoa. This
makes a lot of sense for a language like ObjC, but not nearly as much for
Ruby, since all methods have a return value. Since method chaining is one
of the things that make Ruby so elegant, I propose that all ObjC methods
that are declared to return void actually return the receiver instead.
This will allow for method chaining such as
{{{
if someNSTask.launch.waitUntilExit.terminationStatus == 0
# …
end
}}}
which would otherwise have to be written as
{{{
someNSTask.waitUntilExit
someNSTask.launch
if someNSTask.terminationStatus == 0
# …
end
}}}
.
--
Ticket URL: <http://www.macruby.org/trac/ticket/254>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list