A lot of languages have behaviour that is not defined in the official spec, or might lack a spec in the first place. If the behaviour is consistent and even well known, can such behaviour be used despite being stated in the spec? E.g. in JavaScript the order of keys in an object is officially undefined, but Object.keys
and similar functions are perfectly aware of the order in which the keys were defined and will return it in that way as well. (This might have been defined now in the new ES6, but that's not the point now)
// What I was talking about:
Object.keys({c:1, d:2, a:8, b:-1 });
I will refrain from mentioning the specific answer in the discussion, because there is likely something else wrong with the answer and linking to it will get everybody worked up about that other thing rather than discussing this issue on its own. I will link to this meta post in a comment there and I would kindly like to ask everybody else to refrain from linking back to it as well.
cmp
is another example. Officially, it just returns a positive value, negative value, or 0, but is always implemented to give +1, -1, or 0. \$\endgroup\$