glycerine/zygomys

Reactive programming

purpleidea opened this issue ยท 10 comments

Hi there,

I'm looking to use or write a DFRP, that is a declarative, functional, reactive programming language.
Here are some requirements:

  • implemented in golang
  • reactive
  • declarative
  • possibly functional

This came across my radar, and I was wondering if you had any ideas about how easy/hard it would be to make some aspects reactive? I'm new to lexers and parsers and lisps!

This is meant to be used for https://github.com/purpleidea/mgmt/

Thanks!

Tell me what you mean by reactive, and DFRP.

By "declarative" (the word is used in config management circles) in pure programming circles I think it's more commonly known as "single assignment".

As for reactive (a concept I'm new to) the idea is that the program outputs a stream, which is updated when it's variables change. We might have a lookback cache so that we could have an avg function around a variable that returns a moving average or similar. Many functions are available in this space.

hmm... nothing comes to mind. If you have a simple example, that might help communicate what you're after.

@glycerine That's fair. I'm particularly bad at explaining this, although I'll try and do better in the future.

Does this help? https://en.wikipedia.org/wiki/Reactive_programming
The first paragraph explains it better...

This is exactly the kind of thing that zygo was designed for. Declare and compose a tree that expresses your computation. Use defmap to create your objects. Child objects are simply fields on the object (defmap makes named hash tables). Once you have composed your computation tree you can write go functions that can be invoked to walk the tree and compute results. I've built several similar systems and had wanted the performance of Go with the flexibility of composition that you get from a REPL -- alot of what I had in mind when I made zygo.

@glycerine

This is exactly the kind of thing that zygo was designed for

I am possibly a bit obtuse (sorry), but can you elaborate about how I can transform zygo to make it reactive? Thanks!

You are not making much sense @purpleidea - just program reactively!
Since it is a Lisp, I guess that would be functional reactive..
Reactive is a programming paradigm (read: idea) and you can even use Javascript (Meteor) - so look it up.

I suspect that 'reactive programming' is just another way of describing data-driven programming/design - it is quite trendy these days..

@purpleidea Give us more context/description of the specific problem you are solving. It is easier to speak in specifics. If someone waved a magic wand and gave you "reactive", what would you do with it?

Sorry about this. I'm building a config management tool called https://github.com/purpleidea/mgmt/
We are trying to build an DFRP as mentioned above. Sorry for wasting your time, I will regroup my thoughts and come back if I can describe the problem better.

Thanks!

no worries @purpleidea. There's built in support for the declarative part only. It is easy to declare a computation tree at the repl, using defmap/record objects then pass it to golang for processing. You still have to write all the event handling (applying an event to the tree) and handling of streams of events yourself.