contents   index   previous   next



Unnecessary tokens

 

If symbols are redundant, they are usually unnecessary in ScriptEase which allows more flexibility in writing scripts and is less onerous for users not trained in C. Semicolons that end statements are usually redundant and do not do anything extra when a script is interpreted. C programmers are trained to use semicolons to end statements, a practice that can be followed in ScriptEase. Indeed, some programmers think that the use of semicolons in ScriptEase and JavaScript is a good to be pursued. Many people who are not trained in C wonder at the use of redundant semicolons and are sometimes confused by their use. The use of semicolons is personal. If a programmer wants to use them, then he should, but if he does not want to, then he should not.

 

In ScriptEase the two statements, "foo()" and "foo();" are identical. It does not hurt to use semicolons, especially when used with return statements, such as "return;". But widespread or regular use of semicolons simply is not necessary. Similarly, parentheses, "(" and ")", are often unnecessary. For example, the following fragment is valid and results in both of the variables, n and x, being equal to 7.

 

var n = 1 + 2 * 3  var x = 2 * 3 + 1

 

The following fragment is identical and is clearer, but it requires more typing because of the addition of redundant tokens.

 

var n = 1 + (2 * 3); var x = (2 * 3) + 1;

 

The fragments could be rewritten to be:

 

var n = 1 + 2 * 3

var x = 2 * 3 + 1

 

and:

 

var n = 1 + (2 * 3);

var x = (2 * 3) + 1;

 

Which fragment is better? The answer depends on personal taste. Efforts to standardize programming styles over the last three decades have been abysmal failures, not unlike efforts to control the Internet.

 


Macros