Laurent Sansonetti
lsans****@apple*****
Fri Jun 1 00:45:13 JST 2007
I think we should have both, to not confuse the users coming from the Cocoa world (or used to the old way of bridging). Laurent On May 31, 2007, at 5:35 PM, Eloy Duran wrote: > Probably yeah. > > Do you want those by default? Or should these be added so we have > both: > > def setFoo(arg) > ... > end > > & > > def foo=(arg) > ... > end > > Eloy > > On 5/31/07, Laurent Sansonetti <lsans****@apple*****> wrote: >> Was just thinking about it when coming back to home. We should modify >> the documentation generator to describe the new accessors. >> >> Eloy, would that be possible? >> >> Laurent >> >> On May 31, 2007, at 3:03 PM, Laurent Sansonetti wrote: >> >>> This was committed last night, as r1796 (with a bunch of bugfixes >>> too). >>> >>> Laurent >>> >>> On May 31, 2007, at 10:19 AM, Eloy Duran wrote: >>> >>>> Very nice Laurent! >>>> >>>> On 5/30/07, Laurent Sansonetti <lsans****@apple*****> wrote: >>>>> Hi Michael and all, >>>>> >>>>> I think that we should add a general #foo= -> #setFoo shortcut. >>>>> >>>>> Here is a patch that implements this feature. What do you think >>>>> guys? >>>>> >>>>> With the patch you can do: >>>>> >>>>> myControl.stringValue = 'foo' >>>>> >>>>> but also: >>>>> >>>>> myTableView.dataSource = self >>>>> >>>>> etc... >>>>> >>>>> Laurent >>>>> >>>>> Index: framework/src/ruby/osx/objc/oc_wrapper.rb >>>>> = >>>>> ================================================================== >>>>> --- framework/src/ruby/osx/objc/oc_wrapper.rb (revision 1789) >>>>> +++ framework/src/ruby/osx/objc/oc_wrapper.rb (working copy) >>>>> @@ -77,8 +77,18 @@ >>>>> >>>>> # remove `?' suffix (to keep compatibility) >>>>> # explicit predicate if `?' suffix with OSX.relaxed_syntax >>>>> - as_predicate = (m_name.sub!(/\?$/, '') && >>>>> OSX.relaxed_syntax) ? >>>>> true : false >>>>> + as_predicate = false >>>>> + if m_name[-1] == ?? >>>>> + m_name.chop! >>>>> + as_predicate = OSX.relaxed_syntax >>>>> + end >>>>> >>>>> + # convert foo= to setFoo >>>>> + if m_name[-1] == ?= >>>>> + m_name.chop! >>>>> + m_name = 'set' + m_name[0].chr.upcase + m_name[1..-1] >>>>> + end >>>>> + >>>>> # check call style >>>>> # as Objective-C: [self aaa: a0 Bbb: a1 Ccc: a2] >>>>> # as Ruby: self.aaa_Bbb_Ccc_ (a0, a1, a2) >>>>> >>>>> On May 30, 2007, at 10:08 PM, Michael Basnight wrote: >>>>> >>>>>> Guys, >>>>>> >>>>>> What do yall think of this? It gives OSX::NSControl prettier >>>>>> getters >>>>>> and setters (I only tried OSX::NSTextField). Note this is not >>>>>> just >>>>>> for the string methods, but for %w(double float int object >>>>>> string). I >>>>>> use string as an example. >>>>>> >>>>>> old way (in irb) returns "foo" >>>>>> >>>>>> foo = OSX::NSTextField.alloc.init >>>>>> >>>>>> foo.setStringValue("foo") >>>>>> foo.stringValue.to_s >>>>>> >>>>>> new way (in irb) does the same. >>>>>> >>>>>> foo = OSX::NSTextField.alloc.init >>>>>> >>>>>> foo.string = "foo" >>>>>> foo.string.to_s >>>>>> >>>>>> You can also do a foo.string!, which returns the string and >>>>>> sets it >>>>>> to "" afterwards. It does not work for the object/int/float/ >>>>>> double >>>>>> (e.g., invalid value for Integer: ""), but maybe someone can fix >>>>>> that >>>>>> up. >>>>>> >>>>>> Here is the pastie (http://pastie.caboo.se/66197). What do ya'll >>>>>> think? Wouldn't that be cool to be able to do that w/o hacking it >>>>>> up >>>>>> in rb_main ;) >>>>>> >>>>>> Michael Basnight >>>>>> iHate, a RubyCocoa Utu chat client http://ihate.rubyforge.org >>>>>> >>>>>> _______________________________________________ >>>>>> Rubycocoa-devel mailing list >>>>>> Rubyc****@lists***** >>>>>> http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel >>>>> >>>>> _______________________________________________ >>>>> Rubycocoa-devel mailing list >>>>> Rubyc****@lists***** >>>>> http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel >>>>> >>>> >>>> _______________________________________________ >>>> Rubycocoa-devel mailing list >>>> Rubyc****@lists***** >>>> http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel >>> >>> _______________________________________________ >>> Rubycocoa-devel mailing list >>> Rubyc****@lists***** >>> http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel >> >> _______________________________________________ >> Rubycocoa-devel mailing list >> Rubyc****@lists***** >> http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel >> > > _______________________________________________ > Rubycocoa-devel mailing list > Rubyc****@lists***** > http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel