[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: finite state machine in lua
From:       Jorge <xxopxe () gmail ! com>
Date:       2019-04-29 3:40:27
Message-ID: fa7bd11a-c3c6-d717-c190-dadf0be26e2f () gmail ! com
[Download RAW message or body]

On 28/4/19 23:39, Srinivas Murthy wrote:
> I need to use this for a real-time event sampling use-case.
> https://gitlab.fing.edu.uy/jvisca/ahsm does seem interesting but the 
> cautionary note that its "very alpha quality and not tested ..." is 
> worrisome.

I already considered removing that disclaimer. I should remove it. I 
will. Any moment now :\

>
> Is there any other libs that you could recommend?

When I needed a plain state machine I just rolled my own following one 
of two patterns, the one from 
http://lua-users.org/wiki/FiniteStateMachine and the "functional" one   
(you can see an example of such machine parsing a protocol here: 
https://github.com/xopxe/lua-bencode-push/blob/master/bencode-push.lua). 
In these cases writing the machine felt pretty natural in the code 
itself, and I did not feel the need to use an abstracted library.

When the SM is more complex a library makes sense. We tried to use rFSM 
(https://github.com/kmarkus/rFSM), but run out of memory, and there 
seemed to be too much complexity in there. I just wrote a implementation 
based on its API. This is not the first time this happens to me, find a 
library with an API I want to use, find the implementation too complex 
or with lots of stuff I don't need, and then write my own library from 
scratch inspired by that. I suspect that means that the API is actually 
the hardest part of the library design.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic