dart-lang / core

This repository is home to core Dart packages.
https://pub.dev/publishers/dart.dev
BSD 3-Clause "New" or "Revised" License
12 stars 2 forks source link

package:async - Delegating Streams and Sinks #291

Closed DartBot closed 9 years ago

DartBot commented 9 years ago

Issue by seaneagan Originally opened as dart-lang/sdk#21540


Delegating{List,Map,Set,Iterable} from package:collection are quite useful.

I often need to delegate to Streams and sinks as well. Delegating{Stream,IOSink,EventSink,StreamSink} in package:async would make that much easier.

DartBot commented 9 years ago

Comment by lrhn


Added Area-Pkg, Pkg-Async, Triaged labels.

DartBot commented 9 years ago

Comment by seaneagan


Actually, Stream is easy enough, you just have to delegate in [Stream.listen].

As far as the Sinks go, my actual use case turns out to be to extend Stdin and IOSink. I'm creating a library to allow mocking out io stuff, including stdin, stdout, stderr. I can't extend IOSink or Stdin since they only have factory constructors which delegate to private concrete subclasses. This means I have to copy the implementations of _IOSinkImpl, _StreamSinkImpl, and Stdin.readLineSync, into my library. So my actual request is to make these classes subclassable. I can create a separate bug if that would be better.

nex3 commented 9 years ago

This was fixed in 8d5716a22540bb8e790c3999fded524ac7693f88.