Why don't languages include implication as a logical operator?

Posted by Maciej Piechotka on Programmers See other posts from Programmers or by Maciej Piechotka
Published on 2013-01-18T12:48:46Z Indexed on 2013/10/26 4:10 UTC
Read the original article Hit count: 259

Filed under:

It might be a strange question, but why there is no implication as a logical operator in many languages (Java, C, C++, Python Haskell - although as last one have user defined operators its trivial to add it)? I find logical implication much clearer to write (particularly in asserts or assert-like expressions) then negation with or:

encrypt(buf, key, mode, iv = null) {
    assert (mode != ECB --> iv != null);
    assert (mode == ECB || iv != null);
    assert (implies(mode != ECB, iv != null)); // User-defined function
}

© Programmers or respective owner

Related posts about language-design