Closed hoc081098 closed 1 year ago
Merging #699 (b1b7030) into master (1a8fcef) will decrease coverage by
0.59%
. The diff coverage is56.86%
.
@@ Coverage Diff @@
## master #699 +/- ##
==========================================
- Coverage 93.74% 93.14% -0.60%
==========================================
Files 77 77
Lines 2334 2378 +44
==========================================
+ Hits 2188 2215 +27
- Misses 146 163 +17
I would prefer to leave this sort of thing the responsibility of static type checking. Adding defensive programming here increases the binary size and slightly adds to the computation time, whereas static type checking serves the same purpose but costs nothing at runtime.
What I mean regarding the static typing is that the return type of Subject.stream
is already ValueStream<T>
and so it already restricts the visible interface to the intended one. If a client does try to override the static types at runtime by casting that return type to some undocumented implementation type, it is using undocumented behaviour in which case the library is no longer responsible for perils the client suffers. There is no need to add executable code to defend against clients that try to bypass the declared static types.
Subject.stream
is identical to Subject).ReplaySubject<T>.stream
toReplayStream<T>