cappuccino/cappuccino — pull request #1614 by cacaodev (2012-07-13 20:00:43+00:00)
Title: CPDictionary -initWithObjectsAndKeys: do not treat a nil value as a final value

**Current implementation:**

```objective-j
- (id)initWithObjectsAndKeys:(id)firstObject, ...
{
var argCount = arguments.length;

if (argCount % 2 !== 0)
[CPException raise:CPInvalidArgumentException reason:"Key-value count is mismatched. (" + argCount + " arguments passed)"];

self = [super init];

if (self)
{
// The arguments array contains self and _cmd, so the first object is at position 2.
var index = 2;

for (; index < argCount; index += 2)
{
var value = arguments[index];

if (value === nil)
break;

[self setObject:value forKey:arguments[index + 1]];
}
}

return self;
}
```

The documentation states that *there's no final nil like in Objective-C/Cocoa.*
So why do we break the loop on a nil value ?

Setting a nil value in a dictionary will remove the key/value pair, so i think we should do the same for the initializer and just skip the key/value pair if a value is nil.

... or is it because we unofficially support the old behavior ?