Hi guys! I have an idea, I believe it must exists ...
# thinking-together
p
Hi guys! I have an idea, I believe it must exists but can’t figure out the exact keywords. First, let me enumerate the keywords which I think are related: • Transactions • OO • Eventstreams • “Transactions in OO” or “Transactions with Eventstreams” • Async & Concurrent computation • Erlang / Akka • STM (too low level?) I want to create an object graph (or eventstream graph?) where objects do not have direct reference to each other, they only communicate via messages. Objects are nodes and there is an edge from o1 to o2 if o2 is subscribed to o1 (o1 dispatches events which o2 listens to). Objects supposed to be “Processes” similar to erlang, objects are some kind of an “Async Computation”. Here comes the “new” stuff: There is also a root “StateManager” node which is subscribed to messages contain data about “UPDATING EXISTING IDENTITIES” like “SetGlobalScore <amount>“, any “Async Computation” (object) which directly depends on changing data must subscribe to this root node. If any data gets altered it does not happen immediately but via transactions. The computation which comes up with the new piece of data and wants to share it sends a message to the root “StateManager” node which handles the update. It must check if the data is in use somewhere down in the dependency graph (which I think might be a DAG with the exception of root node): if it is used, the computation might be interrupted (which is more like an exception in my mind) and the whole state might be rolled back to proper state or “handled properly”. If it is not used the state just can be updated: the root emits the message and it propagates down. This is just the core idea and quite vague, but the general goal is to add some safety to concurrent programming. Ah, and I’d like to do that everywhere, not just on server side but on client as well! 🙂
i
This sounds a little bit like π-calculus — https://en.wikipedia.org/wiki/Π-calculus — but with a bit more stuff added on top.
p
Ty, I’ll check it out.
k
@Ivan Reese you've got me reading Milner's tutorial at http://www.lfcs.inf.ed.ac.uk/reports/91/ECS-LFCS-91-180/ECS-LFCS-91-180.ps
i
Let me know what you think. I've only gone as far as buying his book (<https://archive.org/details/communicatingmob00robi>) and reading the first few chapters. So many things...
p
Seems useful for pi calculus:

https://www.youtube.com/watch?v=WO8rGA8AjD0

e
My Beads language does this type of subscription system, with dependency analysis. Dependency analysis was really put forth in PROLOG, and we haven't seen much of it for a very long time. You are entirely correct that this approach solves some, but not all, issues of concurrent programming. It works wonders for multiplayer games, but does not solve the issue of contradictory transactions, which in business is not really done outside of bitcoin-like stuff, because once you transfer money to a bank account, there is nothing stopping the party from further transferring it; so one in general business does not presume unwindability. Traditionally you issue a credit or debit to cancel out the prior transaction, but you don't erase anything ever.
👍 1
p
@Edward de Jong / Beads Project jesus! I was not aware of this but seems really close to my thoughts! (I've just checked a reddit thread by CodingFiend - its you right? :) ). It is really interesting you mentioned Prolog, because I just wanted to add a question to this thread: if you (FoC) are aware of a language which uses declarative constraints + a solver as a robust glue between core pieces of code. With loose declarative constraints instead tight/rigid imperative code seems inevitable to me if we want better programming environment. @Edward de Jong / Beads Project is this something you have already considered, right? Where can I find more about your thinking process which lead you to beads?
@Edward de Jong / Beads Project I asked the question because the links were down for the old site but now I found " http://beadslang.org/blog " and I see the same expressions what I have "fed up with current complex programming" :) Do you have more on the design process? Can try the lang / read a docs?
e
you can take beads for a test drive at beadslang.com. I only have a 100 page user manual and a dozen examples so far. Mac or Windows required for development; emits web apps or using Haxe/Air can generate IOS/Android. I use deduction to determine which part of the screen needs refresh automaticallly. Publish/Subscribe takes advantage of the same internal tracking system. Not a multithreaded system at present. Currently a few people are testing it while we keep on improving the documentation. There are various solvers in the product; one is the layout solver, where you declare the constraints on how you want the objects to be laid out and it does the final calculations. To make things look good on many screen sizes is a very tricky task, and my system aids a skilled programmer but the level of precision one needs to generate mobile apps that fit tight spaces i doubt will ever be easy for anyone. The only other solver in constants use is the rectangle solver. There was a sequel to Visicalc called TKSolver which allowed you to iterate and work backwards; Excel has some of those features, but TKsolver was very clever. I haven't seen anything like it since frankly. So many people working in ML now, solving a formula seems old fashioned. The other area that is highly declarative is the schema designer for the graph database. in Beads you typically declare before you stuff the data into the graph the structure and type of the nodes, which allows the compiler to check for dumb errors. But that is nothing new.
👍 1
p
Great, I'll check out. So there is no generic solver like in Prolog which might determine the temporal order of things (just with more features and different approach)?
e
PROLOG to my knowledge is not a temporal solver, but is decision tree explorer, where you can ask hypotheses and it will do a backtracking search through this decision tree to find a winning match. It could also follow predicate chains; so you could say a dog is a mammal, all mammals nurse their young, and it could make the conclusion that dogs nurse their young. But as the 5th generation project found out to their dismay it is not a good general purpose language, and if you ask someone to make a payroll system in PROLOG they are in deep s**t. Even in areas where PROLOG would be expected to be great, like making a chess program, the winning chess programs use heuristics, and very careful pruning algorithms which PROLOG did not facilitate. I think PROLOG reflects the intrinsic problem of making something too closely tied to logic, and not enough practical aspects. Coq, Agda, and other languages exist which can prove programs correct, but making something useful in those languages is quite difficult. This has created a rather serious gulf between academic logicians and those striving to make a useful tool.
👍 2
p
@Edward de Jong / Beads Project This is why I am really excited about Idris. It wants to be a verifiable general purpose language with dependent types. Programming hard in prolog: I think it reflects on the mostly procedural (temporal?) nature of the useful algorithms. Even in a declarative environment/language like prolog the procedural parts must be written procedurally (embedded in declarative abstractions) - and I think what turns out is that most of the code is procedural(/temporal?) so that’s why it’s not a huge gain itself.
e
Idris was not intended to be a general purpose language. It can't draw in the language, it expects you to call a C compatible library for that. Don't get me wrong, Idris is indeed forward progress for the theorem proving crowd towards some semblance of practical use. But anyone in this day and age who ignores the protected arithmetic of Excel is not leading the charge. At least JS has a 3 valued boolean (Idris is stuck at 2). But Excel has a 4 value boolean which is the proper and final state. There is a whole category of errors related to temporal bugs (i.e. doing something in the wrong order) related to drawing. Every time you change your underlying model in an interactive graphics programs you have to refresh the affected parts. Idris with all of its fancy powers cannot do this, because what is on the screen is outside of their fancy deductive runtime. And they should have included fuzzy logic (which Excel has by virtue of UNDEF# and ERR#) so that one can handle edge cases precisely. In real life some information is known to be missing or is erroneous. You can't pretend in a business program that you have perfect data. You have to account for missing and erroneous data. Maybe some Idris practitioners can rebut these statements, but i can't see Idris helping anyone bring simplicity to programming, which to me is the underlying goal of all of the Future of Computing initiatives. If we can't make it easier overall, then is it progress?
p
@Edward de Jong / Beads Project From https://www.idris-lang.org/ : “Idris is a general purpose pure functional programming language with dependent types.” - this is what I meant.
e
I find Idris to be a very difficult language to learn. It has a lot of abstraction in its definition. People who are knowledgable in proof theory will like it, but for people with more ordinary math backgrounds it is DOA. I would be keen to take some simple project and have someone do it in Idris, and I could use Beads to see how they compare. Maybe some simple graphical interactive project. When you take the same spec, and implement the task in two different languages, and put them side by side you can see much more clearly what is powerful about the runtime. Most languages today carry extremely powerful runtimes, and the syntax of the language can look simple, but not convey the power underneath. For example, the king of multithreaded languages is Erlang/Elixir, because their runtime can handle hundreds of thousands of threads no problem, because of the unique way they give each thread its own heap and stack, which permits super fast garbage collection and relaunch. You can't see this in the syntax, but it is one of its superpowers, and those in the biz know when they need massive multithreading, they reach for that tool.
👍 1