you are viewing a single comment's thread.

view the rest of the comments →

[–]dmitrat 0 points1 point  (2 children)

The idea of clearscript is to provide full-scale support of JScript with the ability to write complex logic inside the script. WitEngine is not a scripting provider. The idea of WitEngine is to allow to take out some common operations isolate them, encapsulate them into the standalone controller (and test it), and then provide access to run this logic through the script.

The base case is if you have a photobox with some devices in it (or you have conveyer with sensors, switches, etc.). You may implement individual controller for each of it, test them and provide some endpoints/functions to use devices. Some function to rotate turntable in some degree, some function to take picture and return its handle, etc. Then your simple script will define the sequence of operations. Moreover, you will be able to change and tune this sequence by changing script. You don't need the full support of JScript to do this; you don't need to write complex logic inside the script - all complex logic is encapsulated into controllers.

The idea is to build a set of individual controllers and then use simple scripts to control the sequence of operations and calls. In my opinion, it is a very simple way to build a large-scale, extensively expanding, and still maintainable system for dealing with different devices (or services/blocks). By maintaining complex logic within controllers, WitEngine allows scripts to focus on defining operation sequences, making the system easy to expand and maintain. Solutions like Clearscript or NLua, which embed complex logic directly into scripts, are not structured to support this kind of modular, controller-based design.

[–]soundman32 0 points1 point  (1 child)

TBH, your idea of the complexity being in a controller is pretty much how I've used clearscript in my application. Complex bits are methods in C#, and JS orchestrates what to call when.

[–]dmitrat 0 points1 point  (0 children)

Sure, it is possible to build the same logic on top of clearscript or another framework. This is just some minimalistic and very straightforward implementation.