sort: allow arbitrary attributes

Hey,

I think Stream.sort behaves like an antifeature. I suggest to allow sorting for arbitrary stats attributes.
This PR is not yet ready to merge, one test is failing.

Opinions?