Re: [MacRuby-devel] super method

2010-09-08 Thread Thibault Martin-Lagardette
Yes, I am very, very sorry I forgot the completely necessary `if (self = [super init])`. It's been a while since I last wrote actual Obj-C code haha. Thank you for correcting me! -- Thibault Martin-Lagardette On Sep 8, 2010, at 16:27, russell muetzelfeldt wrote: > On 09/09/2010, at 4:22 AM,

Re: [MacRuby-devel] super method

2010-09-08 Thread russell muetzelfeldt
On 09/09/2010, at 4:22 AM, macruby-devel-requ...@lists.macosforge.org wrote: > Date: Wed, 8 Sep 2010 11:22:37 -0700 > From: Thibault Martin-Lagardette > >> I don't think I've seen any examples using the initWith method. Is that >> method called after init? > > Simply something of the like: >

Re: [MacRuby-devel] super method

2010-09-08 Thread Thibault Martin-Lagardette
> 3) If I have an empty init, e.g., > > def init; super; self; end > > Can I always delete the empty init and get the same result through > inheritance? Yes, you can omit the #init declaration in this case, it works like a charm, because every Obj-C object (and thus every MacRu

Re: [MacRuby-devel] super method

2010-09-08 Thread Matt Aimonetti
Here is an example: http://macruby.labs.oreilly.com/ch01.html#_class - Matt On Wed, Sep 8, 2010 at 10:52 AM, Robert Rice wrote: > Thanks Matt: > > I don't think I've seen any examples using the initWith method. Is that > method called after init? > > Bob Rice > > > On Sep 8, 2010, at 12:22 PM,

Re: [MacRuby-devel] super method

2010-09-08 Thread Robert Rice
Thanks Matt: I don't think I've seen any examples using the initWith method. Is that method called after init? Bob Rice On Sep 8, 2010, at 12:22 PM, Matt Aimonetti wrote: > initWith ___ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org

Re: [MacRuby-devel] super method

2010-09-08 Thread Caius Durling
On 8 Sep 2010, at 17:22, Matt Aimonetti wrote: > 3) If I have an empty init, e.g., def init; super; self; end >Can I always delete the empty init and get the same result through > inheritance? Yes. Ruby will look for the method in your subclass, then go up the class hierarchy to the

Re: [MacRuby-devel] super method

2010-09-08 Thread Matt Aimonetti
1) Does MacRuby distinguish between Objective C subclasses and other Ruby classes or are all classes treated the same? Not really but Cocoa classes expect to be returned self in the init process and the Cocoa convention is not to overwrite init but to create your own initializer using the initWith

Re: [MacRuby-devel] super method

2010-09-08 Thread Robert Rice
Thanks Matt: Good tutorial on super. Maybe someone could add a keyword section to ruby-doc. This leads me to a couple more questions on super and MacRuby inheritance: 1) Does MacRuby distinguish between Objective C subclasses and other Ruby classes or are all classes treated the same? 2) Can m

Re: [MacRuby-devel] super method

2010-09-07 Thread Matt Aimonetti
Satish has a good blog post on the matter: http://rubylearning.com/satishtalim/ruby_overriding_methods.html You can certainly call super in your subclass before making any modifications or calling super based on a condition. I hope it helps, - Matt Sent from my iPhone On Sep 7, 2010, at 12:5

Re: [MacRuby-devel] super method

2010-09-07 Thread Konstantin Haase
On Sep 7, 2010, at 21:53 , Robert Rice wrote: > I didn't see super in the ruby-doc.org/ruby-1.9/index.html unless super is > short for superclass. In Ruby, super is not a real method call but a key word. Also, it does not behave exactly like a method call (implicit arguments/block and what not)

Re: [MacRuby-devel] super method

2010-09-07 Thread Robert Rice
Thanks Matt: I didn't see super in the ruby-doc.org/ruby-1.9/index.html unless super is short for superclass. Can I reach a superclass method without having the message go first to my subclass override of the method? Bob Rice On Sep 7, 2010, at 3:26 PM, Matt Aimonetti wrote: > No it's not u

Re: [MacRuby-devel] super method

2010-09-07 Thread Matt Aimonetti
No it's not unique to MacRuby (Ruby and Obj-C support that feature) and yes you can pass other arguments :) - Matt Sent from my iPhone On Sep 7, 2010, at 12:16, Robert Rice wrote: > Questions on the super method: > > Is the super method unique to MacRuby? > > super forwards the current mess