djspiewak/anti-xml — pull request #70 by josharnold52 (2011-10-11 21:41:47+00:00)
Title: Miscellaneous Fixes

This is a rollup of some minor fixes that have been on my back burner. I figured it was easiest to put them in a single pull request.

1. `Attributes.updated` and the variadic `Attributes.+` now return an Attributes rather than a Map. They also use the same trick as unary `+` to get the benefit of the `(String, String) => (QName, String)` conversion.

2. `Attributes` is now always backed by an order-preserving map. Prior to this change, it was possible to bypass the companion object and construct an `Attributes` with an arbitrary delegate map. The old constructor still exists for the sake of passivity, but it is deprecated and it copies it's argument to an order-preserving map.

3. `Zipper.withFilter` now preserves the zipper context. The v0.2 Zipper supported this, but we forgot to add it to the new one.

4. All calls to `error` have been changed to `sys.error`, which gets rid of all of our deprecation warnings.

5. `Elem` no longer caches its hashcode. This isn't needed anymore and removing it improves the 7MB load time by 10 to 20 percent. (@ncreep - I know we'll soon be checking for duplicate paths again, but it should now be easy to make the test based solely on location. That's probably a more accurate test anyway.)

For the sake of full disclosure, #1 does introduce a minor compile-time passivity break. Namely, if `attrs` is an `Attributes`, you can no longer write:
```
attrs + ("key","value")
```
Instead, you must write:
```
attrs + (("key","value"))
```

`Map` behaves the same way; `Attributes` was only more permissive because it didn't override variadic `+`, which caused the compiler to give greater weight to the unary `+`. But I'm assuming that was unintentional :-)

Code compiled against the old version of Attributes will still be able to run against the new version; the issue only arises at compile time.