Comments (5)
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.
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.
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.
That type of concern was also the concern that I had shared specifically about class
→ mixin
or mixin class
(just because I think it'll be the most widespread).
from async.
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)
- Change the default of `propagateCancel` argument in CancelableOperation.then HOT 2
- Reset method for AsyncMemoizer HOT 1
- Make it easier to safely hold a reference that can cancel an operation without holding the whole operation HOT 1
- Clarify `StreamQueue.next` will fail just after `hasNext` in API document.
- Consider to make second invocation of `streamQueue.hasNext` be postponed concluding the result until the first invocation of `q.next` , unless the stream is closed. HOT 6
- Deprecate StreamQueue.hasNext and StreamQueue.next
- Future.wait() but with Records HOT 4
- Bad State error while trying to reject a StreamQueueTransaction
- Add `whereNotNull` for `Stream`
- CancelableOperation value is not propagating errors, so they cannot be catched and app is crashing HOT 3
- There should be cancellable versions of Stream.firstWhere etc.
- Migrate the Result type to sealed classes HOT 4
- Make `ParallelWaitError` Include Error Details HOT 1
- Async Cache is caching exceptions HOT 5
- AsyncMemoizer is caching exceptions HOT 2
- Add an API wrapping runZonedGuarded that surfaces the first error HOT 4
- Clarify `CancelableOperation` docs HOT 4
- Inconsistent behavior of `Stream.listen` on broadcast streams HOT 1
- [Proposal] Add a CountDownLatch implementation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from async.