I am reading Cocoa Design Patterns and I like it so far, but on page 141 I found the first thing that I think is wrong and I would not give it a second thought if there wasn't the same thing on page 143 in the method -mutableCopyWithZone: and now I'm not sure if it's wrong at all or if I'm missing something.
Errata for the book is missing in action and gives me: "The journal that this archive was targeting has been deleted. Please update your configuration."
Returning self is wrong?
Yet, that is the first issue I found with this book. Everything before page 141 was so perfect, and now they made the same mistake twice (probably due to copy/paste editing) and of all places in the chapter about copying!
Errata for the book is missing in action and gives me: "The journal that this archive was targeting has been deleted. Please update your configuration."
Code:
- (id)copyWithZone:(NSZone *)aZone
{
id result = [[[self class] allocWithZone:aZone]
initWithWord:[self word] clue:[self clue]];
[[result puzzleSpecificAttributes] addEntriesFromDictionary:
[self puzzleSpecificAttributes]];
return self; // THIS!
}
Returning self is wrong?
Yet, that is the first issue I found with this book. Everything before page 141 was so perfect, and now they made the same mistake twice (probably due to copy/paste editing) and of all places in the chapter about copying!