
SmartReactives: a .NET library that detects when an expression changes its value - steenreem
https://github.com/keyboardDrummer/SmartReactives/blob/master/README.md
======
primigenus
This looks similar to how Meteor's ReactiveVar package, and lower-level
Tracker library, works: [https://docs.meteor.com/api/reactive-
var.html](https://docs.meteor.com/api/reactive-var.html)

It's certainly helped make building real-time user interfaces that update when
the data changes significantly easier in my opinion, because you're able to
express your intent in code more closely to what you mean rather than having
to write all the connecting reactive boilerplate yourself.

~~~
steenreem
Yes Meteor's reactive system seems to be almost identical. Thanks for sharing.

------
maxxxxx
This is neat. I did something similar to this a while ago for WPF databinding
and calculated properties in business objects. Does it support
INotifyPropertyChanged?

One of the problems I found is that a lot of team members don't really like to
think on that level of abstraction. So it was hard to introduce it team wide
and have people keep using it.

~~~
steenreem
Thanks. Yes you can use it to help with INotifyPropertyChanged. The example
'SmartNotifyPropertyChanged' demonstrates one way to do this.

------
sharpercoder
Why use this instead of or with Rx.NET?

~~~
danbruc
There are also Continuous LINQ [1][2], Bindable LINQ [3], Obtics [4] and OLinq
[5], some predating Rx [6][7]. Besides OLinq they all seem no longer
maintained but in case somebody is interested in other existing
implementations, there you go. Also note that they don't all solve the exact
same but similar problems.

[1] [http://clinq.codeplex.com](http://clinq.codeplex.com) [2]
[https://github.com/ismell/Continuous-
LINQ](https://github.com/ismell/Continuous-LINQ) [3]
[https://bindablelinq.codeplex.com](https://bindablelinq.codeplex.com) [4]
[http://obtics.codeplex.com](http://obtics.codeplex.com) [5]
[https://github.com/wasabii/OLinq](https://github.com/wasabii/OLinq) [6]
[https://msdn.microsoft.com/en-
us/data/gg577609.aspx](https://msdn.microsoft.com/en-us/data/gg577609.aspx)
[7] [https://github.com/Reactive-
Extensions/Rx.NET](https://github.com/Reactive-Extensions/Rx.NET)

------
sandGorgon
Does anyone know if you can do this in reactjs? It would be awesome to build a
excel like spreadsheet with user-input formulas.

~~~
untog
Wouldn't it be backwards to do this in React? Everything is controlled by a
state object you manually set, so you already know when values are going to
change.

~~~
sandGorgon
actually - I'm talking about a function expression. Think about a spreadsheet
with a formula similar to "=SUM(A1+B1)". What this means is that when A1 or B1
change.. then this formula result should get re-computed. Remember that A1 and
B1 themselves may be computed results...

what happens today is that I need to recompute ALL formulas - because there is
no easy way to know which formulas changed.

------
nunyabuizness
If you're using JavaScript, MobX [1] is a library available that implements
this pattern, which I find a bit easier to use than Meteor's Tracker yet also
comes with super-performant React bindings.

[1] [https://github.com/mobxjs/mobx](https://github.com/mobxjs/mobx)

------
newtype
I wrote something that does this too! I'm looking forward to seeing the
differences in our implementations :D

~~~
steenreem
Alright. Where can I find your project? You can let me know in Gitter or
e-mail.

------
polskibus
I wonder how does this compare to Jane's Street Incremental library?

~~~
steenreem
My perception is that there's almost no overlap in scope between the two
libraries. In Incremental you have to be explicit about which variables your
computations depends on, while SmartReactives' sole purpose is discovering
these dependencies automatically. SmartReactives discovers dependencies as a
side-effect of evaluating variables while evaluating expressions. OCaml on the
other hand is a mostly pure language so side-effects are not allowed.

Incremental on the other hand does cool stuff like use the result of the first
computation to make the second computation faster, which SmartReactives does
not do at all.

So I'd say although the projects are related they don't overlap in scope.

