-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(virtual-stream): add POC for discussion #61
base: master
Are you sure you want to change the base?
Conversation
Have we decide for sure about the monorepo ? If so do we know what should go in and what shouldnt? like couldnt we add Maybe once we figure what goes in and what doesnt it would help answer about VirtualTimer and specific utils. I can see On the other hand couldnt move all of the packages under If that was the case then it would just be another package under the core monorepo. |
I think so. I mean, this repo already is a monorepo :). We still have manyrepos since we started this one later that the others, of course. As for what goes in and what doesn't, lately I feel like we should just move everything from mostjs that we plan to continue developing into this repo. Well, ok maybe experimental stuff that we're just incubating should stay out.
Yeah, that's now I feel right now, but I'm also open to separating it into a second monorepo if there's a compelling reason. p.s. monorepo feels like the wrong word now, lol. it's more like a multirepo, as in "multiple packages per repo". 🤷♂️ |
Just pushed an update that includes |
Hmmm, there's a potential circular dependency: eventually, we'd probably want to rewrite the
|
5abad63
to
e9e4899
Compare
Rebased on latest master ... also, simplified |
Anything happening here still? |
Yes, definitely. I've been focusing on docs and getting |
Is there still a desire to move on this? |
Hey @gabejohnson. Yeah, I'm still keen on something like this, and I need to make time to revisit. Lately, I think it can all be much simpler, though. For example, it's actually possible to do most/all of this stuff by just having a virtual time scheduler, and using There are definitely still things that would be useful, such as rendering a stream into an ascii diagram. |
Add virtual-stream, a package for creating "virtual streams", which are in-memory, "fake" representations of event streams where all the events (and their occurrence times) are known ahead of time. They are easy to visualize (i.e. render), and useful for testing. It'd be easy to write constructors to create virtual streams from ascii marble diagrams, arrays, etc to facilitate testing. It should also be possible to implement functions that convert to/from real most.js event streams, again for testing and visualization.
Motivations
Testing
Given a way to convert between real event streams, virtual streams could provide a simple way of testing event streams. A few examples, with the help of some imaginary helper functions:
Visualization
Envision a virtual stream as a finite Array of
{ time, value }
objects. Given that, rendering it into various formats is relatively simple:And given a way to convert from a real stream to a virtual stream, real streams can be rendered easily:
Details
This implementation uses an array of "virtual events", like
Array<{ time: number, value: A }>
, which seems like a solid, explicit way to represent events. On top of that it adds a VirtualStream sum type that explicitly captures the notions of a:These variants make it relatively easy to do things like:
Open questions
periodic
Visualization example above, which had to usetake
before callingvstreamFromStream
.@most/core
monorepo or maybe another (mono)repo dedicated to virtual streams or testing?Todo