Hacker News new | past | comments | ask | show | jobs | submit login

http://blog.moertel.com/articles/2006/10/18/a-type-based-sol... is a very good read on the subject. basically, the compiler can have different types of strings, depending on where they come from, and how they are created. it can then make sure that different types of strings are never mixed without an explicit conversion operation. it is up to the programmer, of course, to see to it that that conversion operation involves sanitising, but the compiler will make sure you don't do

    string a = get_input_from_user();
    string b = sql_lookup(database, a);
    insert_into_output_html(b);
requiring instead

    UserInputString a = get_input_from_user();
    SQLResultString b = sql_lookup(database, ConvertUserInputToSQLQueryInput(a))
    insert_into_output_html(ConvertSQLResultToHtml(b));



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: