#254: Let void-returning ObjC calls return the receiver.
--------------------------------+-------------------------------------------
Reporter: mik...@… | Owner: lsansone...@…
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/>
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel