#726: Methods added to String do not get added to all strings
---------------------------------+------------------------------------------
 Reporter:  dy...@…              |       Owner:  lsansone...@…        
     Type:  defect               |      Status:  new                  
 Priority:  blocker              |   Milestone:                       
Component:  MacRuby              |    Keywords:                       
---------------------------------+------------------------------------------
Changes (by martinlagarde...@…):

  * milestone:  MacRuby 0.6 =>


Comment:

 Hi!

 This is because of the way strings are implemented within MacRuby. If you
 look at the result of this command:
 {{{
 macruby -e 'p String.ancestors'
 [String, NSMutableString, NSString, Comparable, NSObject, Kernel]
 }}}

 You can see that `String` is defined on top of of `NSMutableString`, which
 is why defining a method on `String` won't define it on `NSMutableString`
 or `NSString`.

 In your example, if you replace "`class String`" by "`class NSString`",
 then it will work as expected:
 {{{
 String
 Bacon!
 String
 Bacon!
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/726#comment:1>
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