Programming Corner from Icon Newsletter 2


August 4, 1979; Icon Version 1

The most interesting language issue to date is the "SNOBOL4 syndrome". It is natural for SNOBOL4 programmers to be interested in Icon and, to date, most Icon programmers have had considerable SNOBOL4 programming experience. One natural consequence of this is the tendency to transfer SNOBOL4 programming idioms to Icon. The results frequently are awkward in Icon. The typical reaction is to compare Icon unfavorably to SNOBOL4 or to suggest new features for Icon to make it resemble SNOBOL4 more closely.

A typical paradigm is the SNOBOL4 pattern
(P1 P2) | P3
The corresponding structure in Icon is
(e1 & e2) | e3
An examination of the actual use of such constructions frequently reveals that the desired effect can be obtained by
if e1 then e2 else e3
In other words, the mutual success of e1 and e2 and the backtracking implied by the alternation operation often is not actually needed. In cases when the latter construction will suffice, it is clearer, more efficient, and prevents unintended backtracking in cases where it should not occur.

In more involved cases, the "SNOBOL4 syndrome" produces Icon code that is awkward to understand and debug. Stated differently, it seems to take some time for SNOBOL4 programmers to become acculturated to Icon and to learn to use traditional control structures effectively, especially in string analysis.

On the other hand, Icon itself contains a considerable heritage from SNOBOL4, much of it unintentional and despite attempts to avoid inherited features. We suspect, therefore, that the design of Icon contains a considerable measure of the "SNOBOL4 syndrome" that has not yet been recognized. This suggests that some major work needs to be done to the language features of Icon -- although, frankly, the direction is not yet clear to us.

Icon home page