Support for with-stream-style implementation