Hacker News new | past | comments | ask | show | jobs | submit login

Harel's recent work (which evolve from Statecharts) is so called Scenario-based programming. If interested I follow his work very closely and showcase his techniques in this article about bthreads: https://lmatteis.github.io/react-behavioral/



Maybe I'm just super dumb but I don't get why such simple examples should be made so difficult. Take for instance the following: "Here were are introducing the 3 main critical pillars of Behavioral Programming; the request, wait and block semantics.".

Except the previous block of code does not exhibit the 'block' semantic at all.


There is something weird in the implementation...

> Try adding two X's in a row. It will not work. It's waiting for an O, and once that is triggered it waits for an X and so on.

If you try to make a move out of turn it seems like the illegal move is still "queued up" somehow. So as soon as you make a legal move the previously attempted illegal one occurs, as it's now legal.

In fact, this resulted in an interesting game where both sides won:

    { type: "X", payload: 0 }
    { type: "O", payload: 8 }
    { type: "X", payload: 1 }
    { type: "O", payload: 2 }
    { type: "X", payload: 3 }
    { type: "O", payload: 6 }
    { type: "X", payload: 7 }
    { type: "O", payload: 5 }
    { type: "X", payload: 4 }
    { type: "XWins" }
    { type: "OWins" }
I guess it needs a few more behaviours...


Which version outputs this behavior? The earlier ones are on purpose buggy. As the computer bthread is added there's no way for it to start at tile 8.

The point was to show how by adding new bthreads the system gets smarter and less buggy.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: