#712: Feature Request: Add Support for C-Level Blocks
-------------------------------+--------------------------------------------
 Reporter:  cwdi...@…          |       Owner:  lsansone...@…        
     Type:  enhancement        |      Status:  new                  
 Priority:  blocker            |   Milestone:  MacRuby 0.7          
Component:  MacRuby            |    Keywords:  block                
-------------------------------+--------------------------------------------
 The following (proposed) syntax should work:

 {{{
 open_panel = NSOpenPanel.openPanel
 open_panel.beginSheetModalForWindow(@main_window,
     completionHandler:lambda{|arg|
       puts "Hello, open file and user arg is #{arg}"
       }
     )
 }}}

 Also, this should work:

 {{{
 def handler(arg)
   puts "Hello, open file and user arg is #{arg}"
 end

 open_panel = NSOpenPanel.openPanel
 open_panel.beginSheetModalForWindow(@main_window,
     completionHandler:handler)
 }}}

 There may be a more elegant Rubyish way to do this, but I'm not seeing how
 the proper selector syntax would be created. Here's what I mean:

 {{{
 open_panel = NSOpenPanel.openPanel
   open_panel.beginSheetModalForWindow(@main_window) do |arg|
     puts "Hello, open file and user arg is #{arg}"
   end
 }}}

 But the last example gives no hint that the block selector should be
 completionHandler:

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/712>
MacRuby <http://macruby.org/>

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to