Comments (6)
Interesting. Could you update your example to something more real? I'm curious to see how it would work with different handlers for different layers of the stream (if that makes sense). Or is it that the handler just handles the tail end of the stream and doesn't do any filtering or manipulation to parts prior?
from vblang.
My understanding of Observable, that this would fired every time the Observable "Pushed" a new value onto OnNext
.
dim _HeartBeat = Observable.Interval(TimeSpan.FromSeconds(1))
Function HeartBeat(x As Long) Handles _HeartBeat.OnNext
' Triggered every ~second
End Function
Think this needs a lot more bake time.
from vblang.
You can already do the following with Rx.NET:
Dim o = Observable.Interval(TimeSpan.FromSeconds(2))
o.Subscribe(Sub(ByVal value As Long)
' triggered every second
End Sub)
For language integration I'd personally rather see asynchronous enumerators in async methods, something like:
Dim o = Observable.Interval(TimeSpan.FromSeconds(2))
For Each Await value In o
' triggered every second
Next
from vblang.
@HaloFour The Idea was to be able to treat them as an event-like object.
from vblang.
I kinda think of IAsyncEnumerable and the Await Each loop to be foregone conclusions at this point :)
I'm pretty hesitant on Rx. Can you point me to a killer sample app on it that really highlights why people love it?
from vblang.
I'm pretty hesitant on Rx. Can you point me to a killer sample app on it that really highlights why people love it?
From what I gather most people don't seem to understand it. It's simply nothing more than the combination of events and LINQ. If you needed to do anything complicated with a stream of push-based notifications (which all user-interface interactions are), then it's a lot easier to feed that through a LINQ query rather than subscribing to a bunch of events disparately and maintaining a state machine full of variables in order to detect when the right combination of things has happened.
But yes, I do understand that the language teams are largely settled on the IAsyncEnumerable<T>
concept, which is effectively the same except it requires that the consumer continually request the next value. That's not unlike the Rx concept of backbuffer where the consumer can inform the producer how many values that it is ready to accept, only that the consumer can only request one at a time. That model will be considerably slower for streams processing.
Fortunately bridging Rx and IAsyncEnumerable should be pretty easy. In fact if async enumeration supports extension methods to resolve GetAsyncEnumerator
then the above code could work out of the box. That bridge could allow the consumer to configure such things as over-subscription via buffer of events or the like.
I find it funny and sad that Rx is being adopted more readily outside of the .NET world. Netflix completely rewrote it for Java and has based quite a few of their libraries on it, including Hystrix which I use extensively for bulk-heading and fault tolerance. I'm currently using RxJava to work on an asynchronous JSON parsing and data-binding engine which I can feed from an NIO loop so that I can shred through massive JSON documents with virtually no memory overhead and without blocking.
from vblang.
Related Issues (20)
- [Proposal] Additional Kinds of Is Clauses
- (off-topic?) inter-language 'drag race' competition HOT 20
- [Proposal] Tuple Sub-Clauses
- Support unmanaged generic constraint for interop with C#
- [T(Index) Is Nothing] is [CObj(T(Index)) Is Nothing] instead [T(Index) Is Default]. HOT 5
- Discard XML namespaces HOT 2
- Strange “type of” HOT 3
- ByRef Me for Structure HOT 3
- Record method for My.Computer.Audio HOT 3
- Custom implicit Ctype is not used in dynamic mode HOT 4
- [Proposal] ReadOnly As InitOnly Properties
- "Two Anxieties and One Unarticulated Need - Why doing nothing is sometimes the right thing to do" -- Anthony D. Green HOT 5
- "An Alternative Path" HOT 2
- Open Silver Roadmap: VB.Net support HOT 1
- VB to support consuming API that has required members. HOT 3
- Open Letter on the Visual Basic Strategy 2023 HOT 34
- CDate(CStr(Nothing)) should not cause an exception HOT 5
- 请支持vb,please support vb HOT 10
- Small Visual Basic is meant to attract kids to VB .NET HOT 1
- null-conditional for boolean operation should be typed to nullable HOT 6
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 vblang.