A lot of mechanisms prevent common errors in Cyan:
- there cannot be any
returnstatements inside anonymous functions - exception handling is made using anonymous functions and, therefore, there cannot be
returnstatements inside either try blocks or catch clauses - there should be a space before and after
=and the relational operators<,<=,>,>=,==, and!= - no parentheses are necessary for the
ifandwhileexpressions but the brackets are required ifstatements may be nested but they should be correctly indented- no automatic conversion between basic types,
'var Int n = 1.0'is illegal. This prevents a lot of errors caused by the combination of overloaded methods with automatic conversion - overloaded methods are clearly marked with keyword
overload. A method overridden in a subprototype cannot be overloaded unless the superprototype method is marked withoverload - constructors
initandinit:can only use a limited form of overloading that makes errors associated with overloading impossible - there are severe restrictions on the initialization of prototype fields making it very difficult to use a field before it is initialized. But in these rare cases, there will be a runtime error
