From: Ferhat A. <fer...@ya...> - 2008-04-14 12:32:12
|
Ruby methods indeed do not define return types but Obj-C does. I'm not sure but I guess the problem is that you are sending an "unknown" message to dataSource and it treads it as obj-c id type. So you would see the same compiler error if you try. id something; NSSize originalSize = something; You have to define it in an obj-c interface. @interface KNTiledMap (ImNotSureButMaybeYouHaveToDoItAsCategory) - (NSSize)dimensions; @end Ferhat ----- Original Message ---- From: Knud Hinnerk Möller <knu...@de...> To: rub...@li... Sent: Monday, April 14, 2008 1:51:59 PM Subject: Re: [Rubycocoa-talk] Importing Ruby Classes into Obj-C code Am 14.04.2008 um 12:20 schrieb Ferhat Ayaz: > are you sure that [dataSource dimensions]; returns an NSSize? No, I can't be - Ruby methods don't define a return type. The error already happens at compile time, not at runtime. Knud > > > Ferhat > > ----- Original Message ---- > From: Knud Hinnerk Möller <knu...@de...> > To: rub...@li... > Sent: Monday, April 14, 2008 12:56:52 PM > Subject: [Rubycocoa-talk] Importing Ruby Classes into Obj-C code > > Hi, > > please forgive me if this is a stupid question to ask, but is it > possible to import a Ruby class definition into Obj-C? What I mean is > this: > > I have a RubyCocoa class: > > class KNTiledMap < OSX::NSObject > attr_accessor :dimensions > ... > end > > I have an Obj-C class in which I want to use the Ruby class: > > @interface KNTileView : NSView { > KNTiledMap *dataSource; > } > > @implementation KNTileView > ... > NSSize originalSize = [dataSource dimensions]; > ... > @end > > This leads to a compile "error: invalid initializer". > > How can I make this work? > > Cheers, > Knud > ------------------------------------------------- > Knud Möller, MA > +353 - 91 - 495086 > Smile Group: http://smile.deri.ie > Digital Enterprise Research Institute > National University of Ireland, Galway > Institiúid Taighde na Fiontraíochta Digití > Ollscoil na hÉireann, Gaillimh > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save > $100. > Use priority code J8TL2D2. > http://ad.doubleclick..net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Rubycocoa-talk mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save > $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________ > Rubycocoa-talk mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk ------------------------------------------------- Knud Möller, MA +353 - 91 - 495086 Smile Group: http://smile.deri.ie Digital Enterprise Research Institute National University of Ireland, Galway Institiúid Taighde na Fiontraíochta Digití Ollscoil na hÉireann, Gaillimh ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Rubycocoa-talk mailing list Rub...@li... https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ |