OpenSCAD1 reports virtually no error messages about bad code, beyond a few syntax errors detected by the lexer and parser. This has two negative consequences:
-
Ease of use. Common mistakes made by beginners, such as typing
cube(x,y,z)
instead ofcube([x,y,z])
, are not reported. It is frustrating to figure out what went wrong in your script when OpenSCAD provides no assistance. -
Our ability to extend the language with new features suffers if everything is legal. For example, we are extending the
center=
parameter ofcube
to accept a vector of booleans. But according to the wiki,[true,false,false]
is already a perfectly valid Boolean value that is equivalent totrue
, so in principle, we can't make this change without breaking a legal program. If some programs were illegal, and if this was enforced by error messages, then we could safely extend the language by reinterpreting illegal programs as legal ones.
For these reasons, OpenSCAD2 has stricter error reporting.
OpenSCAD2 should report errors for:
- Definitions and Scoping
- reference to undefined name
- name defined multiple times in same scope
- Functions
- function call f(x) where f is not a function or object
- function call with too few parameters
- function call with too many parameters
- function call with unknown named parameter
- Objects
- adding a value that is not a shape or an object