Avoiding Loose Typing Dangers

Sometimes I like terse code. if( state ){} is clear. However this syntax can cause a lot of grief in loose typed languages, and while you can avoid some cases by typing vars, you can still get yourself into trouble (as a note: I find strict mode a pain in ActionScript). if( GetState() ){} may mess you up if the function returns a string, where if( GetState() == false ){} will do the type conversion for you and function properly.

If you liked it, share it:

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Blogplay
  • blogmarks
  • DZone
  • Identi.ca
  • LinkedIn
  • Reddit
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

There are no comments, yet.

Why don’t you be the first? Come on, you know you want to!

Leave a Comment