nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32

Home Page:https://nodemcu.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Port LuaCSP concept to nodemcu

Bazmundi opened this issue · comments

Missing feature

Noting I am not proposing to do this myself, since I do not have deep enough knowledge of lua language internals, but respectfully recommend nodemcu team look at https://github.com/loyso/LuaCSP and perhaps looking at whether a similar pseudo parallel model could be implemented into nodemcu or variant.

Justification

Essentially, CSP, Actor orientation and other similar frameworks are enabling developers to build more interesting solutions because of the abstractions available, that help soften the blow of building parallelism into their applications:

http://htmlpreview.github.io/?https://github.com/loyso/LuaCSP/blob/master/doc/html/LuaCSP.html

Workarounds

Work arounds include event passing such as in Lua RTOS, or tasks and semaphores in C++ using (very clunky and the style of "parallel" programming the more sophisticated approaches such as CSP and Actors is trying to avoid).

Perhaps actor based approaches in Lua such as luactor or Dialoge though they are different semantically to CSP.

NodeMCU is intrinsically event driven (and a good way to crash the system is to hog the CPU for too long), making the utility of an additional actor framework not readily apparent to me. That is, because one has to explicitly program with continuations already, and manage those continuations' invocations on external events, it seems like all the work has already been done.

Perhaps I am missing something, tho'?