-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[NSDictionary] Implement description, descriptionWithLocale, descriptionWithLocale:indent and tests #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
get { | ||
var _description: String = "{\n" | ||
for key in self.allKeys { | ||
_description += " \(key) = \(objectForKey(key)!);\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if you have a dictionary of strings to dictionaries? shouldn't this cascade with indentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phausler also what would the expected behaviour be in this situation if someone has done something like make a dictionary of dictionaries with many levels of depth? Some kind of termination at some point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so description should probably call descriptionWithLocale:indent: which that I would not expect to iterate more than say 100 deep. most likely at that level there is probably an error in the caller's code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍- perfect, thanks for the heads up and apologies for the rookie move on my part by not looking there first 😊
What would be the expected behavior if a negative indent level is passed? |
id say that would definitely be in the territory of programmer error or undefined behavior for the darwin version. So perhaps precondition if you think it warrants it; the objc version's interface is an NSUInteger for the level which gets translated to Int in swift unfortunately. |
It that okay to change the indent level type to UInt? |
UInt would diverge from the API that is currently exposed in swift on Darwin platforms. Even though it would be more type safe it would diverge usage patterns. So lets keep it as Int |
…ionWithLocale:indent and tests
I updated it as requested. Since most classes' |
looks like a pretty decent start to me, will merge once I can verify tests on linux |
[NSDictionary] Implement description, descriptionWithLocale, descriptionWithLocale:indent and tests
Add ExecuteCommand/ApplyEdit
No description provided.