Shunting

From triplescripts.org wiki
(Redirected from Main)

The shunting block is the real entry point to any given program implemented as a triple script. In the triple script concatenated t-block format, the shunting block is the one that appears in the tail position (i.e. the last one). The shunting block is the only block allowed to have zero exports, because its main role is to initialize the system layers and pass control to the real "heart" of the program (which should be the first block, i.e. the one appearing at the beginning of the file). By convention, the shunting block is called "main".

The shunting block is written as a top-level IIFE, and it is the only top-level IIFE that is permitted to do any substantial computation; all other blocks are strictly module definitions. Other modules are permitted to have top-level IIFEs, but only as a compatibility hack for supporting older runtimes with no intrinsic support for the class keyword. These incidental IIFEs are permitted only to make use of simple assignments within the IIFE scope for defining the shape of the module through method definitions and other property definitions.

trplkt's shunting strategy uses the SystemA design pattern.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.