Program design

From Emergent

Jump to: navigation, search

Contents

Design of the Program System

All User-controllable Settings Must be in args or vars

  • Do not embed important control vars in ProgEl's within the program. The user is not expected to navigate programs. The new control panel will only present var values from args or vars. For example, the BasicDataLoop used to have its order parameter locally in the object. It was not clear that the user would know to look in there for it. Now, it automatically creates a order_var that is a HardEnum pointing to the enum in this object, and auto gets its value from that.. This is the model to follow.

New Features to Improve Robustness

Referring to variables within programs

  • Key principle for ProgEl variable use: All variables used must have a ProgVarRef -- this ensures that when the variable changes/is deleted, the ProgEl is updated (via SmartRef_DataChanged).
  • Args and various other cases which require more flexible expressions should use a ProgExpr, which parses a free-form string expression for variables, and creates associated ProgVarRefs for them, and updates them when they change names, etc. Good combination of flexibility and robustness..

ProgLib loading pointer resolution

When loading a program from the library, need to update variables according to current configuration of things. Otherwise, it can just be random what it ends up pointing to, based on the current config etc.

  • In principle, anything that points to anything needs to have this. This includes Object progvars, and Program calls. Simplest thing is to just have an additional field that contains a script that is used to gen code that says "ptr = expr;" Programs iteratively go through and create this code (in a separate script object? overwriting current script and then regenerating actual script? as a separate function like _Init within script?? in a separate static script that is only used for this purpose? maybe that is best..
Personal tools