Re: [MacRuby-devel] Cocoa Slides in MacRuby

2010-09-08 Thread Felix Holmgren
Hey Matthew,

I'd probably be interested in contributing to a MacRuby implementation
of Slides. Please post here if you create a repo at github, codaset,
or something like that.

/Felix

> Laurent
>
> On Aug 27, 2010, at 7:52 PM, Matthew Smith wrote:
>
>> I'm looking at implementing the Cocoa Slides sample application 
>> (http://developer.apple.com/mac/library/samplecode/CocoaSlides/Introduction/Intro.html)
>>  in MacRuby. Has anyone attempted this yet or interested in contributing?
>>
>> Thanks,
>>
>> Matthew Smith
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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 my inheritance path be arbitrarily long before I inherit from NSObject 
or an NS subclass?

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?

Bob Rice


On Sep 7, 2010, at 4:13 PM, Matt Aimonetti wrote:

> 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:53, Robert Rice  wrote:
> 
>> 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 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 message to the superclass with the same method 
 name and arguments. Is there a way to send a message to the superclass 
 method with different arguments either from within the subclass method of 
 the same name or from outside the subclass method of the same name to 
 bypass the subclass method?
 
 Thanks,
 Bob Rice
 
 ___
 MacRuby-devel mailing list
 [email protected]
 http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>> ___
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>> 
>> 
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Cocoa Slides in MacRuby

2010-09-08 Thread Matthew Smith
Laurent,

Do I need to get some sort of internal apple approval post this project on 
github?

Matthew

On Sep 7, 2010, at 11:33 PM, Laurent Sansonetti wrote:

> Hi Matthew,
> 
> Looks like a valuable addition to me :) Thanks for proposing to work on this. 
> It looks ambitious so if you need help you should probably post it on github 
> so that others can translate the original code too.
> 
> Laurent
> 
> On Aug 27, 2010, at 7:52 PM, Matthew Smith wrote:
> 
>> I'm looking at implementing the Cocoa Slides sample application 
>> (http://developer.apple.com/mac/library/samplecode/CocoaSlides/Introduction/Intro.html)
>>  in MacRuby. Has anyone attempted this yet or interested in contributing?
>> 
>> Thanks,
>> 
>> Matthew Smith
>> 
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Cocoa Slides in MacRuby

2010-09-08 Thread Felix Holmgren
Nope:

In consideration of your agreement to abide by the following terms,
and subject to these terms, Apple grants you a personal, non-exclusive
license . . . to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary
forms; provided that if you redistribute the Apple Software in its
entirety and
without modifications, you must retain this notice and the following
text and disclaimers . . .

Neither the name, trademarks, service marks or logos of Apple
Computer, Inc. may be used to endorse or promote products derived from
the Apple Software without specific prior written permission from
Apple.  Except as expressly stated in this notice, no other rights or
licenses, express or implied, are granted by Apple herein, including
but not limited to any patent rights that may be infringed by your
derivative works or by other works in which the Apple Software may be
incorporated.


2010/9/8 Matthew Smith :
> Laurent,
>
> Do I need to get some sort of internal apple approval post this project on 
> github?
>
> Matthew
>
> On Sep 7, 2010, at 11:33 PM, Laurent Sansonetti wrote:
>
>> Hi Matthew,
>>
>> Looks like a valuable addition to me :) Thanks for proposing to work on 
>> this. It looks ambitious so if you need help you should probably post it on 
>> github so that others can translate the original code too.
>>
>> Laurent
>>
>> On Aug 27, 2010, at 7:52 PM, Matthew Smith wrote:
>>
>>> I'm looking at implementing the Cocoa Slides sample application 
>>> (http://developer.apple.com/mac/library/samplecode/CocoaSlides/Introduction/Intro.html)
>>>  in MacRuby. Has anyone attempted this yet or interested in contributing?
>>>
>>> Thanks,
>>>
>>> Matthew Smith
>>>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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 pattern. In Ruby, #initialize is often
overwritten.

2) Can my inheritance path be arbitrarily long before I inherit from
NSObject or an NS subclass?
Yes, consider the following example:

> class Foo; end; class Bar < Foo; end; class Baz < Bar; end; class Bob <
Baz; end
=> nil
> Bob.ancestors
=> [Bob, Baz, Bar, Foo, NSObject, Kernel]

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?

I am not sure what you mean, sorry :(

- Matt


On Wed, Sep 8, 2010 at 8:50 AM, Robert Rice  wrote:

> 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 my inheritance path be arbitrarily long before I inherit from
> NSObject or an NS subclass?
>
> 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?
>
> Bob Rice
>
>
> On Sep 7, 2010, at 4:13 PM, Matt Aimonetti wrote:
>
> > 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:53, Robert Rice  wrote:
> >
> >> 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 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 message to the superclass with the same
> method name and arguments. Is there a way to send a message to the
> superclass method with different arguments either from within the subclass
> method of the same name or from outside the subclass method of the same name
> to bypass the subclass method?
> 
>  Thanks,
>  Bob Rice
> 
>  ___
>  MacRuby-devel mailing list
>  [email protected]
>  http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> >>> ___
> >>> MacRuby-devel mailing list
> >>> [email protected]
> >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> >>>
> >>
> >> ___
> >> MacRuby-devel mailing list
> >> [email protected]
> >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> > ___
> > MacRuby-devel mailing list
> > [email protected]
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> >
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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 superclass and check there for the method there, calling it if 
it's found.

So a method that just contains 'super' [although not 'super()' as that calls 
super with no arguments] is doing the same job as the method not being defined 
in the subclass.

C
---
Caius Durling
[email protected]
+44 (0) 7960 268 100
http://caius.name/

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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, Matt Aimonetti wrote:
>
> > initWith
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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 MacRuby object) inherits from 
NSObject, that has its own -init method.
What this means is if you don't define yours, calling -init on your object will 
call NSObject's -init, just like in Obj-C :-)

class Hello
def world
  puts "Hello world!"
end
end

Hello.alloc.init.world


> I don't think I've seen any examples using the initWith method. Is that 
> method called after init?

Simply something of the like:

- (id)initWithDelegate:(id)someDelegate
{
[self setDelegate:someDelegate];
}

or

- (id)initWithColor:(MRColor)color andBorderSize:(int)borderSize
{
[self setCubeColor:color];
[self setBorderSize:borderSize];
}

Hope this helped :-)

-- 
Thibault Martin-Lagardette



On Sep 8, 2010, at 09:22, Matt Aimonetti wrote:

> 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 pattern. In Ruby, #initialize is often 
> overwritten.
> 
> 2) Can my inheritance path be arbitrarily long before I inherit from NSObject 
> or an NS subclass?
> Yes, consider the following example:
> 
> > class Foo; end; class Bar < Foo; end; class Baz < Bar; end; class Bob < 
> > Baz; end
> => nil
> > Bob.ancestors
> => [Bob, Baz, Bar, Foo, NSObject, Kernel]
> 
> 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?
> 
> I am not sure what you mean, sorry :(
> 
> - Matt
> 
> 
> On Wed, Sep 8, 2010 at 8:50 AM, Robert Rice  wrote:
> 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 my inheritance path be arbitrarily long before I inherit from NSObject 
> or an NS subclass?
> 
> 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?
> 
> Bob Rice
> 
> 
> On Sep 7, 2010, at 4:13 PM, Matt Aimonetti wrote:
> 
> > 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:53, Robert Rice  wrote:
> >
> >> 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 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 message to the superclass with the same 
>  method name and arguments. Is there a way to send a message to the 
>  superclass method with different arguments either from within the 
>  subclass method of the same name or from outside the subclass method of 
>  the same name to bypass the subclass method?
> 
>  Thanks,
>  Bob Rice
> 
>  ___
>  MacRuby-devel mailing list
>  [email protected]
>  http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> >>> ___
> >>> MacRuby-devel mailing list
> >>> [email protected]
> >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> >>>
> >>
> >> ___
> >> MacRuby-devel mailing list
> >> [email protected]
> >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> > ___
> > MacRuby-devel mailing list
> > [email protected]
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> >
> 
> ___
> MacRuby-devel mailing list
> MacRuby-dev

Re: [MacRuby-devel] super method

2010-09-08 Thread russell muetzelfeldt
On 09/09/2010, at 4:22 AM, [email protected] 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:
> 
> - (id)initWithDelegate:(id)someDelegate
> {
>[self setDelegate:someDelegate];
> }
> 
> or
> 
> - (id)initWithColor:(MRColor)color andBorderSize:(int)borderSize
> {
>[self setCubeColor:color];
>[self setBorderSize:borderSize];
> }

Those are never actually initialising the object - do you mean something like 
this? (assuming the class in question doesn't inherit from something with a 
different designated initialiser)


- (id)initWithDelegate:(id)someDelegate
{
  if (self = [super init])
  {
[self setDelegate:someDelegate];
  }
  return self
}

or

- (id)initWithColor:(MRColor)color andBorderSize:(int)borderSize
{
  if (self = [super init])
  {
[self setCubeColor:color];
[self setBorderSize:borderSize];
  }
  return self;
}


cheers

Russell

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


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, [email protected] 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:
>> 
>> - (id)initWithDelegate:(id)someDelegate
>> {
>>   [self setDelegate:someDelegate];
>> }
>> 
>> or
>> 
>> - (id)initWithColor:(MRColor)color andBorderSize:(int)borderSize
>> {
>>   [self setCubeColor:color];
>>   [self setBorderSize:borderSize];
>> }
> 
> Those are never actually initialising the object - do you mean something like 
> this? (assuming the class in question doesn't inherit from something with a 
> different designated initialiser)
> 
> 
> - (id)initWithDelegate:(id)someDelegate
> {
>  if (self = [super init])
>  {
>[self setDelegate:someDelegate];
>  }
>  return self
> }
> 
> or
> 
> - (id)initWithColor:(MRColor)color andBorderSize:(int)borderSize
> {
>  if (self = [super init])
>  {
>[self setCubeColor:color];
>[self setBorderSize:borderSize];
>  }
>  return self;
> }
> 
> 
> cheers
> 
> Russell
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Release Build

2010-09-08 Thread Henry Maddocks

On 8/09/2010, at 6:31 PM, Laurent Sansonetti wrote:

> Hi Henry,
> 
> Sorry for the late response.
> 
> On Sep 6, 2010, at 5:52 PM, Henry Maddocks wrote:
> 
>> I've been working on a MacRuby/Cocoa app and I'm getting to close to 
>> release. Is their any docs on how to prepare your app for release? Any tips 
>> or tricks?
>> 
>> I know I will need to embed MacRuby in my app but is there anything else 
>> that is required/recommended, eg. can you compile the code?
> 
> You just need to add the Embed and Compile targets in your project. These 
> targets just call the macruby_deploy command-line tool on your application 
> bundle, so you may want to look at the tool by yourself in case your build 
> process is different.
> 
> These 2 operations will embed MacRuby and compile all your project's source 
> code into machine code, removing the .rb files after. It should then be ready 
> for release.

That was easy: )

Cheers

Henry



___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel