[MacRuby-devel] [MacRuby] #601: hashes with empty values cannot writeToFile

MacRuby ruby-noreply at macosforge.org
Tue May 11 20:11:05 PDT 2010


#601: hashes with empty values cannot writeToFile
--------------------------------+-------------------------------------------
 Reporter:  lastobelus@…        |        Owner:  lsansonetti@…        
     Type:  defect              |       Status:  closed               
 Priority:  major               |    Milestone:                       
Component:  MacRuby             |   Resolution:  invalid              
 Keywords:                      |  
--------------------------------+-------------------------------------------
Changes (by lsansonetti@…):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 This is expected behavior.  The same code in Objective-C also fails:

 {{{
 $ cat /tmp/t.m
 #import <Foundation/Foundation.h>

 int main(void)
 {
     NSLog(@"-> %d", [[NSDictionary dictionaryWithObject:[NSNull null]
 forKey:@"foo"] writeToFile:@"/tmp/foo" atomically: YES]);
     return 0;
 }

 $ gcc /tmp/t.m -o /tmp/t -fobjc-gc -framework Foundation
 $ /tmp/t
 2010-05-11 20:08:59.906 t[43283:107] -> 0
 }}}

 The documentation for -[NSDictionary writeToFile:atomically:] states:

 {{{
 This method recursively validates that all the contained objects are
 property list objects (instances of NSData, NSDate, NSNumber, NSString,
 NSArray, or NSDictionary) before writing out the file, and returns NO if
 all the objects are not property list objects, since the resultant file
 would not be a valid property list.
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/601#comment:3>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list