Obvious/pipette — pull request #8 by danfuzz (2012-06-21 21:42:55+00:00)
Title: Add construction-time checks for already-ended streams.

Original commit message below.

This addresses @dpup's comment from PR #7.

/cc @dpup
/cc @mikefleming

R=mike
R=dan

##########

This also factors out the rest of the source validation code.

I ended up implementing this to throw when the edge case in question is
detected, rather than silently papering over it, because this imposes a
more minimal burden and provides an opportunity to catch programming
errors.

If we also want to have a way to silently accept ended streams, I can
build that, but it'll be a little more involved. I *think* the right
way to do that would be to define alternate constructor functions that
make it clear that that's what's happening. (And if so, please consider
that to be out-of-scope for this PR.)