I found this blog post, which describes a way to protect against "SQL injection" attacks using the type system, to be really enlightening.

http://blog.moertel.com/articles/2006/10/18/a-type-based-solution-to-the-strings-problem

Justin