SodiumFRP / sodium

Sodium - Functional Reactive Programming (FRP) Library for multiple languages
http://sodium.nz/
Other
848 stars 138 forks source link

Implementation of Sodium in Python #177

Closed mode89 closed 2 years ago

mode89 commented 2 years ago

Mostly one-to-one port of the Java implementation.

mode89 commented 2 years ago

Hi @jam40jeff, @huanhulan :) I'm sorry to bother you. Do you happen to know if this repository is maintained? If so, who is in charge?

Best regards, Andrey

clinuxrulz commented 2 years ago

Think everyone here is just feeling a little bit tired. For some of the languages it requires us to implement our own garbage collector inside sodium, which is a bit of a tedious, error-prone/draining sort of task.

All the people in the group https://github.com/SodiumFRP have the permissions to merge your pull request, but it is up to @the-real-blackh to decide. The general pattern we are going for is 1 repository per implementation:

@the-real-blackh is the author of the book "Functional Reactive Programming". He most likely had the life sucked out of him more than the rest of us. Be nice to him.

Looking in here https://github.com/orgs/SodiumFRP/repositories: we have sodium-typescript sodium-kotlin sodium-swift etc.

It would be best to place it there, so the Issues/Pull requests can be divided up per implementation.

If you make a separate copy of your repo with only the Python implementation, you can make a request to move it to SodiumFRP, and someone in the group can approve it to get added.

ziriax commented 2 years ago

Think everyone here is just feeling a little bit tired. For some of the languages it requires us to implement our own garbage collector inside sodium, which is a bit of a tedious, error-prone/draining sort of task.

What would be the reason that pure reactive programming (FRP) is not mainstream yet?

Frameworks like React, SolidJS and Svelte introduce a little bit of reactive programming, so that is a good evolution, but far from perfect.

For the last 10 years I have been working on a platform to make the concept of first order synchronous dataflow programming more approachable, with schools as a target audience, but schools don't want to use it because no mainstream programming languages adopts it. I try to sell it as "being closer to pure mathematics, the programming language of the last millenia", but to no avail. Almost all schools use Scratch, which introduces imperative programming, but allows parallel blocks with mutable variables... At coderdojo sessions I tried to help kids that made "advanced" games with Scratch, and 30 years of game programming experience was not enough to easily find their bugs, apparently, lol...

My platform isn't finished yet, and maybe it never will be, but nevertheless I am curious about your opinions.

PS: I posted it here since I don't see a Github discussions tab.

dakom commented 2 years ago

What would be the reason that pure reactive programming (FRP) is not mainstream yet?

Imho it's largely a popularity contest. If Lady Gaga put out a music video featuring FRP, and Twitter advertised that they're using it, and Apple announced a first-class FRP framework in Swift in their keynote, I'm sure interest would climb drastically.

Popularity and marketing aside, I do think the very popular reactive/FRP-ish web frameworks you mentioned owe a lot to FRP. Web programming in general feels much closer to FRP than OOP or ECS. Also lots of node-based editors with unidirectional dataflow like Unity's shader editor, is kinda in the same headspace.

My platform isn't finished yet, and maybe it never will be, but nevertheless I am curious about your opinions.

Sorry to hear you've been having trouble with selling your product. Sucks :/ Hope you find success!

I spent the bulk of my career in the non-profit ed-tech space. The last big project was https://jigzi.org (source at https://github.com/ji-devs/ji-cloud - built mostly on a FRP framework Dominator/futures-signals)... I had to step down and take a job in a totally different industry (cryptocurrency) for personal finance reasons... I'd say altogether I spent something like 15 years or more directly in some form of ed-tech or another, and unless you have political connections with the people who buy products on a government / public-school level, it's very hard to make it (but those who do get those contracts are doing very well)

Wish you lots of luck! I do agree that FRP is a fantastic mental model for teaching programming at an early age

ziriax commented 2 years ago

What would be the reason that pure reactive programming (FRP) is not mainstream yet?

Imho it's largely a popularity contest. If Lady Gaga put out a music video featuring FRP, and Twitter advertised that they're using it, and Apple announced a first-class FRP framework in Swift in their keynote, I'm sure interest would climb drastically.

Yeah, well, I witnessed this over and over with technology, marketing usually wins...

Popularity and marketing aside, I do think the very popular reactive/FRP-ish web frameworks you mentioned owe a lot to FRP. Web programming in general feels much closer to FRP than OOP or ECS.

Today, it certainly is. I'm having great fun with React's rendering paradigm and hooks, the former feels like a pure function, the latter as an FRP cell.

Also lots of node-based editors with unidirectional dataflow like Unity's shader editor, is kinda in the same headspace.

Yep, but they don't offer reactivity. I borrowed the merge, snapshot etc operators from Conal Elliott and Paul Hudak. Actually, I worked together with Conal a long time ago🤓

When a friend of mine that was senior procedural artist at Ubisoft (now at Nvidia) discovered my platform, he was very excited, since it was the first playground that allowed him to make simple games and user interfaces. Because he worked with dataflow languages in SideFX Houdini, it all felt very natural to him.

Sorry to hear you've been having trouble with selling your product. Sucks :/ Hope you find success!

Well, luckily I didn't start selling it yet, I just demonstrated the current state at STEM fairs. And it's a side project, although funded by the Flemish government.

When I explain to educators that children shouldn't just learn who to DO actions, but also how things ARE described, like in math and physics, they all seem to understand that importance. But most teachers are struggling themselves to understand programming at the most basic level, and maybe the declarative/FRP approach is bridge too far, I have no idea.

I spent the bulk of my career in the non-profit ed-tech space. The last big project was https://jigzi.org (source at https://github.com/ji-devs/ji-cloud - built mostly on a FRP framework Dominator/futures-signals)... I had to step down and take a job in a totally different industry (cryptocurrency) for personal finance reasons... I'd say altogether I spent something like 15 years or more directly in some form of ed-tech or another, and unless you have political connections with the people who buy products on a government / public-school level, it's very hard to make it (but those who do get those contracts are doing very well)

That is sad to hear, the planet needs more people like you?

Wish you lots of luck! I do agree that FRP is a fantastic mental model for teaching programming at an early age

I hope so, you describe my feelings very well, but I have no proof of that (chicken or egg problem?)

Actually, I taught my own son programming with my platform when he was 6 years old. But when he switched to Unity3D at a later age, he didn't understand why objects were not in sync when he made the camera point to a target object. I explained him that target object was updated after the camera, so it had a delay of a frame. It took him a while to switch his mental model. And I'm actually doing anti-marketing here, exactly describing why FRP it is hard to sell, because the traditional software s*cks 🙈

Anyway, I discovered functional and reactive programming way too late in my carreer, and I had a very hard time to switch my mental model, and I'm still a padowan that is learning. I'm afraid kids will have a similar hard time if they just learn imperative/OO/ECS, and the world will just keep fixing bugs and hacking software in the same old fasioned unreasonable way.

jam40jeff commented 2 years ago

To answer the previous question, @the-real-blackh has historically had the final say for major things such as new languages, although it seems as if he hasn't been active lately. To be fair, neither have I, but I have been using Sodium for almost all new development I have done in the past 5 years. It has been incredibly stable and functional for me, and I haven't had to do any maintenance on it. At some point, I need to go through the open issues and get caught up, though. Also, I only use the dotnet implementations (both C# and F#) and consider those to now be the most up-to-date versions of Sodium.

mode89 commented 2 years ago

Thank you guys for the feedback :) I close the PR then, to move the code into a separate repository as @clinuxrulz suggested.

mode89 commented 2 years ago

Hi @the-real-blackh :) Thank you very much for bringing Sodium to the world. Your book is an amazing reading.

Do you think it is alright to put this implementation under umbrella of SodiumFRP group? Given what was said above, I started thinking that maybe I should keep this code under my GitHub account, since I am not sure if I will be able to put enough effort into maintaining it and I don't want to put extra burden on the shoulders of Sodium community.

This code worked for me, though. I used it on my own project. There is also an example code that should work out-of-the-box on most of the systems.

ziriax commented 2 years ago

Hi @the-real-blackh :) Thank you very much for bringing Sodium to the world. Your book is an amazing reading.

Absolutely!

mode89 commented 1 year ago

The code has been moved here.