display | more...

Statements of the form "X = Y" or "X == Y" are often used in online communication to express the meaning "Y is a property or description of X". One particularly common example is "you = stupid". The most frequent users of these statements are individuals who have a good deal of contact with programming languages. It is therefore strange that the usage does not conform to that of the majority of languages, including C. C is a particularly good language to demonstrate this because both of these constructs exist in C and many of the users of the two statements probably have a greater degree of experience with C-derived languages.

In C "X = Y" means "from now until the next time we modify X, X is equal to the current value of Y". This is clearly not the intended meaning of the use in online communication. When one says "you = stupid" one usually does not intend to imply that the addressee was previously not stupid (technically, "equal to a stupid") and has only just become so at the moment of writing, which would be a potential interpretation if the intended meaning was identical to the that of the C.

The meaning of "X == Y" in C does not fit either. It is "the truth or falsity of the statement 'X is equal to Y'". Again, this is obviously not the correct interpretation. Assuming that the addressee is in fact stupid all saying "you == stupid" does is provide an alias for "true".

The intended meaning of "X = Y" is, again, an assertion that Y is a property of X. The closest "translation" of this into C uses assert. The exact implementation would vary, but it would most likely involve defining X as a struct containing the properties of the described object.

The pseudocode would then be something like:

assert(isPropertyOf(Y,X));

A slightly more accurate interpretation ditches imperative programming entirely. The Prolog equivalent would be a database entry similar to the following:

y(x).
Or, using our example:
stupid(you).


It's been brought to my attention that the above analysis neglects several types of interpretation of the statements. "X = Y" can also mean "X is a member of the class Y", "the class X is equivalent or subordinate to the class Y", or "X is the same object as Y, equivalent in all its properties". These can be modeled with assertions without reliance on structs, though the second could be somewhat problematic in its implementation.

Log in or register to write something here or to contact authors.