Some Words About Ambiguity

Since we seem to be approaching the craft of programming from a more linguistic than mathematical perspective, we would do well to consider the problem of ambiguity. In general, computer languages cannot tolerate ambiguity, yet in everyday speech we put up with it all the time and make the best guesses we can.

What conclusion do we come to when we hear that “Maria was stung by a bee in a purple bathrobe”? There are two ways to interpret the sentence. We as experienced listeners have a reasonable expectation that people are more likely to wear bathrobes than bees are, which helps us get the interpretation right. But when a listener has no domain knowledge, or understanding of the universe that the sentence is talking ...

Get Sams Teach Yourself Ruby in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.