Table Of Contents
Programming Graph IDE consists of running scripts that utilize a built-in script engine. That script engine can access methods in plugins that you write. In addition, the script engine can access many Cocoa and system classes, objects and associated methods as well as traditional functions. The script engine (called SAM for State AutoMation) is also a general purpose code parser. As a result of the complex nature of programming there are issues that you should be aware of. Those issues are listed as follows.
- Make sure to comprehensively specify the declaration section of the scripts. Without a declaration, the script engine may produce unintended results.
- The script engine implements comprehensive error checking to prevent known errors and cascading of errors. When you write a script then click the Execute button and check the Error tab for any errors. If the script does not execute then check it carefully for spelling and syntax errors. If you encounter an unexpected result then please email firstname.lastname@example.org with a bug report.
- The Program inspector editor is just a text view, it is not an IDE (Interactive Development Environment) editor. You may wish to first paste a pre-made script into a text editor (or Xcode or other IDE), modify it to your needs, paste it into the Program inspector editor source code text view and then click the Execute button to make sure it parses and alters the associated graphic. Once the code is confirmed to execute then save the document as desired.
- You can bind the script to any accessible object or class. If you do that then make sure to fully declare the method API in a class block. Because you are calling into code sections that are not known in advance you may encounter bugs and unpredictable behavior.
- The script engine parses and binds in a pre-stage separate from execution. That means it is fast to execute, but still not as fast as writing a Xcode plugin and compiling to assembly language with optimizations such as inlining, etc. At some point, you may wish to use a Plugin and call a single method defined in that plugin to execute the algorithm that would normally be in the script. There are several reasons to do that including optimization and familiarity with the Xcode IDE.
- If you have a preexisting code base and library that exists in Xcode and wish to use that then a plugin is the way to go. You can wrap your code into a single method which can then be called from a script.
- Recursion is implemented with the
recur method. Of course recursion is a very powerful feature, but if you do not check for an end to the recursion (using
recursionCount) then the recursion will be infinite and that will cause the usual problems (running out of memory, etc.) so make sure to terminate recursion appropriately by using a conditional.
- If you save the document while animating then when the document is subsequently opened it will start animating right away. If a script is not written correctly then the document may crash. That means the document will be inaccessible. As a precaution, opening a document that is set to animate will present a sheet with the option to animate or not. Choosing not to animate will give you an opportunity to fix the script.
- If you move a plugin (using the Finder for example) then it will not load and you will have to reload the plugin based upon its new location.
- The script parser is set to not warn about syntax errors nor is it set to format syntax. As a result, if you write code incorrectly then that code will silently fail to parse.
- Make sure to close blocks correctly (pair brackets such as curly brackets and parentheses).
A few issues are listed above. If you have a suggestion to make programming easier then please email email@example.com.