While doing a review, I came across this snippet of code: asserts = append(isAliveDoc, asserts...)
It took me a while to understand why the thing that is being appended is at the beginning. I realize it probably wants to insert it at 0, but I thought it was an object, not a slice, so how could it go at the beginning. But digging shows it is actually a slice: https://github.com/juju/juju/blob/master/state/life.go#L36 var isAliveDoc = bson.D{{"life", Alive}} and bson.D: http://bazaar.launchpad.net/+branch/mgo/v2/view/head:/bson/bson.go#L118 type D []DocElem Doesn't that mean that every time we call something like this, we are potentially mutating the isAliveDoc statement? I realize it probably "works" because isAliveDoc has capacity 1 and thus must be reallocated everytime you append, and thus we don't end up with an isAliveDoc that actually carries arround all the assertions from everything else. but that seems very "assume no bad side effects" rather than valid code. Thoughts? John =->
-- Juju-dev mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev
