Giter Club home page Giter Club logo

Comments (5)

lrhn avatar lrhn commented on August 15, 2024 1

The problem comes if someone creates a new interface, say class StreamWithLatest<T> extends Stream<T> { T get latest; bool get hasLatest; StreamWithLatest(Stream<T> source) ... }, which (makes no logical sense, but also) is both an implementation and valid interface that someone can implement in their own way.
(You should never do that! Favor composition over inheritance! But it'll happen.)

If they then decide to use StreamView as an implementation choice,

class StreamWithLatest<T> extends SteamView<T> {
  bool get hasLatest => ...
  T get latest => ...

  StreamWithLatest<T>(super.stream);

  StreamSubscription<T> listen(...) {
    // special implementation
  }
}

then they suddently have to make their StreamWithLatest class base and disallow people from implementing it.
For no good reason.

I'll remove the base from StreamView, and see if I can get it cherry-picked.

from async.

lrhn avatar lrhn commented on August 15, 2024

Maybe it was a mistake to make that one base.
Other similar classes have been transformed back to non-base, because it wasn't strictly necessary, and it annoyed subclass authors.

There is no good reason to ever implement StreamView, but it probably also won't hurt anyone but yourself if you do so. Having to write base on all subclasses isn't helping anyone.

from async.

natebosch avatar natebosch commented on August 15, 2024

Ah, I hadn't considered how a non-breaking change in the SDK could force down a breaking change on a package like this...

from async.

oprypin avatar oprypin commented on August 15, 2024

That type of concern was also the concern that I had shared specifically about classmixin or mixin class (just because I think it'll be the most widespread).

from async.

natebosch avatar natebosch commented on August 15, 2024

Having to write base on all subclasses isn't helping anyone.

I think it helps consumers of DelegatingStream in a similar way to StreamView - it guides towards correct usage.

This class doesn't have any reason to exist anymore in package:async. It would make me a little sad if we have to ship a sub-optimal SDK because of a legacy class in package:async that isn't providing any value to anyone.

I think this class looks like, where it has been used, it's mostly been used correctly. We could check more carefully for usage and add base without a major version bump in this package.

from async.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.