-
Notifications
You must be signed in to change notification settings - Fork 331
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
Bacon.js 4.0 #771
Comments
Property reactivation alternative is something to consider: #770 |
"Property shall always have a current value" is something that's super nice for GUI applications where you want to render a Property's value on the screen. Instead of a white screen you want a value that representing the status Not at all sure what would be the negative implications here. |
|
"Property shall always have a current value"
Indeed! For that purpose I have begun to put Maybes in some of my GUI properties. I initialise with If you suggest by your comment, that v.4.0 enforces initial values for properties, I'd regard it beneficial. Static Function API for 4.0As already stated somewhere else I no longer like dot-chaining Baconjs pipelines, i.e. glueing Observable method calls, but I'd rather compose static functions which
This makes Baconjs play nice with functional libraries like Ramda. Btw @most/core has such an API. Here is an example of that style. A small step into that direction would be to make However, for the arguments made in this article by James Sinclair I prefer the StaticLand specification over FL. Thus Baconjs had also provide a static |
I've also thought about changing the API from method chaining to static method piping. That would be awesome! I'm all in for going into that direction, given that someone had the energy and time to actually do the hard work :) This might not prove a huge undertaking, given that the operators are already defined as static functions in individual files, while the Observable classes just define methods that delegate the work to the static functions. Wanna give it a shot? |
Yeah could do it. |
...but this might be a great opportunity for you to hone your TypeScript skillz to the next level :) I didn't know much TS either before I migrated Bacon from ES to TS. |
I don't know. I did quite a lot in C++ where anything cool involves template classes and functions - but they're hard to get right and add so much noise. Moving to dynamically typed languages like JavaScript felt like getting rid of chains holding me back. If I had the choice now I'd migrate to something like ReasonML where you have the benefits of type safety but it is the compiler who figures it all out and the code still looks nice. Anyway, let's make Baconjs nice! (Perhaps I will also draw some inspiration from @most/core which is also written in TS) |
Consider the following code: const stream$ = Bacon.once('Hello')
const unsubscribe1 = stream$.onValue(value => console.log('1:', value))
const unsubscribe2 = stream$.onValue(value => console.log('2:', value))
unsubscribe1()
unsubscribe2() Output in v1:
Output in v2 (I think) & v3:
Proposed output in v4:
This would make |
|
Controversial idea: Consider renaming the library for broader (non-carnivorous programmer) appeal. I realize the name refers to the philosopher rather than the meat, but many wouldn't take the time to find out and, even if they did, it still has the meaty connotation. It doesn't bother me personally, but it might be hurting adoption. |
Add a Assuming the generic type of type Collector<FROM, TO> = (source: Observable<FROM>) => Promise<TO>
class Observable<VALUE> {
// ...
collect<TO_VALUE>(collector: Collector<VALUE, TO_VALUE>): Promise<TO_VALUE> {
return collector(this)
}
} Proposed collectors:
Examples:
|
I started experimenting with a new library that deals with my grievances with Bacon when used in UI programming. Go check out: https://github.com/raimohanska/lonna. Totally experimental for now. I'm a bit excited about it anyway :) |
Started to add Fantasy-Land methods in the "fantasy-land" branch. Reactive streams cannot obey all FL laws while at the same time providing useful implementations – as discussed in #352 . Even libraries providing a monadic alternative to Promise – so in a way "single value reactive streams" do not adhere to the strict FL rules - as most of them provide a parallel executing With those FL methods ( The rest of the static functions could perhaps be provided by an augment library for example like purifree-ts is for purify-ts. |
Placeholder issue for all things that might be included in 4.0. Post your ideas and vote with emojies. Knock yourself out!
The text was updated successfully, but these errors were encountered: