Optional Syntax Should Be Illegal

Why in the world do some programming languages include optional syntax? To a true type A engineer, this is incomprehensible and unacceptable. For example, in Adobe’s ActionScript, statements may optionally be terminated with a semicolon. Usually this is not required, except in a few situations you need it. Evil. The statement that our number one job as software engineers is to manage complexitity really resonates with me, and willy nilly allowing of optional syntax just destroys consistency, predictability, and simplicity for no reason whatsoever. Optional syntax seems to me a bad language design smell that indicates the language authors need to rethink a bit and find something that works always and should be required.

Part of the impetus for this post is my annoyance when my thinking cycles are wasted on unimportant details in a source code file. I’d rather have a strict format so that whenever I am reading or writing in a language, there will be a strong and deep consistency. I don’t have to spend time deciding whether I’m going to use some optional syntax or which of the several ways to express the same thing I’m going to use. Similarly, when I come upon someone else’s code and it’s a mixture of two optional approaches, I feel compelled to go and make it consistent, which is another time waster.

2 Comments

  1. Bernard says:
    Something tells me that might be my code that was semi-semicoloned. If that’s the case – sorry about that. I agree that optional syntax is stupid.
  2. Pete says:
    ALL ActionScript is like this. It’s not just your code. It’s built into the language and therefore guaranteed to plague 99.6% of every .as/.mxml file you encounter.

Leave a Reply