Skip to main content
2 of 2
Added some context, etc.

Meme: Option Strict On

Originator: VB.NET

Cultural Height: It's larger in need than it appears.

Background: Visual Basic 6.0 wasn't too fussy about strict typing. You could add integers to strings and usually get the result you wanted. And vice-versa. Usually. VB.NET promised to change that and let you get predictable results from your code. As in, the prediction you made, and not what the compiler felt like doing. But that promise is Optional, and not Strictly On as the default.

Corollary: If your code does not compile after setting Option Strict On, it was faulty anyway.

Caveat: Without hours of delving through imprecise documentation, some things can only be found out at run-time. The increase in entropy of the universe for allowing run-time determination of types may be less than the entropy increase resulting from figuring out how to strongly-type something.

Usage: If someone asks a VB.NET question, look for something like TextBox1.Text = x + 5. Found it? Yes! Add a comment like "You should use Option Strict On to point out some problems in your code." Your work is done.

Andrew Morton
  • 3.4k
  • 17
  • 22