The Dio Programming LanguageHomepage Documentation Efficiency Syntax and FAQs
Nulls And Errors Must Be Checked
Take this example code. The compiler will report two errors
When working with integers it'd be extremely weird if both "value<0" and "value>=0" are both false. Whenever something is null it must be checked before using the value. Errors must always be checked, but have a special syntax
Variables Are Marked
In many languages a programmer may assume a variable might be modified when it is passed into a function. In C and C++ it is extremely common to use pointers and the 'const' keyword to prevent the pointer from being modified. Lots of data are reused across objects and usually those languages speed is important and objects are reused. Conditionally modifying data may surprise programmers and cause bugs.
In dio the calling function has to use symbols to denote what data may be modified an what data is given away. NOTE: Next release may offer alternative syntax
Here we can plainly see b might be modified and c is given away. Using c after the function call will cause an error
Minor improvements were made to prevent annoyance and errors due to typos some are
- Int's are not bools. So if 1 and intValue && intValue2 are compile errors
- Operator precedence has been changed. The bit operators (& | ^) are higher precedence than compare (==, !=) so 6&2 != 0 is true and 6|2 != 0 doesn't magically become a 7
- Because = creates a variable accidentally writing if a=b will cause a compile error even if a and b are bool
- Writing a|b&c will cause a compile error since it's easy to confuse the precedence order. Currently the compiler allows this syntax. Earlier the compiler gave a syntax error and stops which was annoying so it was disabled. Later the compiler will report this as a logical error.