Re: formatting issue in gdb
Re: formatting issue in gdb
- Subject: Re: formatting issue in gdb
- From: Quincey Morris <email@hidden>
- Date: Fri, 13 Aug 2010 14:11:29 -0700
On Aug 13, 2010, at 13:55, Ludovic Nicolle wrote: Well, it rather looks like [NSArray description] escapes line endings in the strings that are the descriptions of each element
I agree that this seem to be the behavior, but only partially. For those elements that are also Cocoa Containers, NSArray will honor the newlines and display them properly.
You're assuming that [NSArray description] obtains description strings of each element, and then does some formatting magic with these strings. If anything, your example strongly suggests that it doesn't use description strings for elements that are themselves Cocoa collections. so that those line endings don't render ambiguous the [NSArray description]'s own inserted (formatting) line endings. Seems perfectly reasonable to me.
I do not see why it would be ambiguous in any way, personally. When you print an NSArray of NSDictionaries of NSArrays, they all print their own newlines and there is nothing ambiguous there. Why would it be different when instead of an NSDictionary in there, I have a MyDictionary instead?
It's ambiguous because a newline within a string really exists as data, while newlines used solely for formatting don't. If string element newlines are honored, then you can't reliably tell the number of elements in an array of strings.
What's a MyDictionary? Your example classes weren't collections (in the Cocoa sense), so it's not surprising that any special formatting of collections didn't happen to them.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden