Saturday, December 19, 2009

while ( write( read(resource) ) ) # no ;
#pragmatic programming

while(write(read())) may not be as succinct as the equivalent expression in Rebol, but this Icon expression - which composes correctly in ObjectIcon, UNICON, Converge and ICON itself - has an important property: it can fail and its failure is neither an exception nor an error.  And until it fails, it succeeds.

Yet for all the pragmatic programmer interest in languages such as Erlang and Clojure, Icon seems to attract no interest at all (judging from activity at the code.google pages for ObjectIcon.)

Indeed, the apparent disappearance of goto as a reserved word in JavaScript-family languages (except DMDScript, where goto is implemented) would seem to indicate that the Algol-like syntax of the replacement for SNOBOL may never get the attention it deserved.  GOTO is now masked as throw and try/catch and break-to-tag and the "resume-elsewhere-as-resume-next" of Icon failure may remain unknown to another generation of programmers.

When I last looked, goto remained an unused reserved word of Java, just as it was of JavaScript. For programmers who never worked with Prolog back-tracking, the idea that boolean expressions evaluate to TRUE or FALSE may seem a truism.  But it remains the case that a great deal of the internet, for one striking example, depends on all manner of objects deemed "empty" to default in boolean expressions to an evaluation as FALSE.

Just as it was false that SNOBOL would never be performant (SPITBOL put that to rest but too late), so it was false that GOTO is always dangerous (and useful long jumps in C are still with us.)

There is a useful word in German, Aufhebung, which does not always translate cleanly into English: but it might be the one word to capture the response of Icon to the challenges laid before SNOBOL by Algol, Fortran, Pascal and C.

You need only consider that recent languages as advanced as Java, C#, Curl, ECMAScript, Python and Scala continue to use Regular Expressions as if there had never been a programmers' tool which was an alternative to Perl.  PCRE is now an acronym if not also a shibboleth.

Icon was intended for non-computer scientists to use just as was SNOBOL before it, but even an MIT language intended for visual artists, Processing of proceessing.org, continues to advise its users to learn regexp.

Perhaps the release of ICON 9.5 (under the guidance of an award-winning CS teacher and mentor) will attract some attention. Or the future release of pythonic Converge 2.0

But I have my doubts.  Perhaps it will come when an HP innovator looks at available languages for new help center software for help desks in Africa.  Perhaps the interest will come from Latvia or western China.  In any other area of applied science, the likes of regexp would have been gone.  But we have yet to fall under the spell of some great offering us the dictum "RegExp considered harmful".

while ( write( read( responseStream ) ) ) 
# idiom, semi-colon terminator optional

PS
Icon: generators, iterators, practical co-routines, goal-directed evaluation, expression-based language (Carl Sturtivant, G. Townsend with others)
ObjectIcon: UNICODE Icon with classes (Robert Parlett)
Converge: pythonic Icon (Laurie Tratt)
Rebol: www.rebol.net, www.rebol.org, www.rebol.com (from Carl Sassenrath and team; now in alpha for REBOL 3 with closures and modules)
Curl: Clojure-like homiconic web content language with macros, closures, optional types and permiting scoped tags within iteration macros to facilitate expressions such as the macro {for tag=outer permitting {break tag=outer}

2 comments:

KanjiRecog said...

PPS
Neither GOTO nor LABEL are part of the ICON language.

Java shares main() with ICON in name only: the main() of ICON is a resumable co-routine.

ICON revivals CLU, Self, Strongtalk and Smalltalk-80 for unacknowledged influence on languages such as JavaScript and Python if 2007-2009 Podcasts by Yahoo architect Douglas Crockford are any indication.

KanjiRecog said...

Silly published claim: that JavaScript is not the ancestor of ActionScript; rather that both ActionScript and JavaScript share a common ancestor: ECMAScript (printed in popular how-to book on Future Splash, aka Flash, ISBN 0-672-32385-0 on page 10.)