# 1999/1/27
What is the Icon Programming Language?
excerpt: from
Ralph E. Griswold, Clinton L. Jeffery and Gregg M. Townsend,
"Graphics Programming in Icon",
Peer-to-Peer Communications, 1998,
Chapter 1, pages 1-2.
The Icon Programming Language
Icon is a general-purpose programming language that
emphasizes ease of programming. Although similar in appearance to
languages like Pascal and C, Icon has much more to offer. Here are
some of its distinctive aspects:
-
Strings are atomic values, not arrays of characters. An extensive
and sophisticated set of operations supports analysis, synthesis, and manipulation
of strings.
-
List operations generalize the concept of an array to implement stacks,
queues, deques, and similar structures.
-
True polymorphism allows values of any type in data structures, argument
lists, table indices, and other roles.
-
Sets and tables provide quick lookup using index values of any type.
-
Programmer-defined record types allow representation of complex data relationships.
-
Underneath Icon's conventional syntax lies a powerful goal-directed evaluation
mechanism that searches for a result among multiple computational paths.
-
Automatic storage management, with garbage collection, eliminates tedious
and error-prone manual allocation.
These features combine to make programming substantially easier in Icon
than in any other languages.
Graphics in Icon
Icon's graphic facilities also emphasize programming
ease. Many graphics systems require that a program be able to redraw
the contents of a window upon demand -- for example, when the user moves
another obscuring window out of the way. In Icon, this is handled
automatically. Once something is drawn to the window, it stays drawn,
and any necessary refreshing is handled by the Icon system without involving
the application program.
Many systems impose an event-driven paradigm in which
a graphics program acts only in response to user or system requests.
While such an approach is often best, there are many situations where a
procedural view is sufficient -- and much simpler. Icon allows both
approaches.
A friendly programming interface does not preclude
a wide range of features. From the perspective of a programmer, Icon
offers the following kinds of graphic capabilities:
-
Windows can be opened and closed as desired.
-
Points, lines, polygons, circles, arcs, curves, and text can be drawn.
-
Color can be specified by numeric value or descriptive phrase.
-
Windows can be treated as files for reading and writing text.
-
Fixed and proportionally spaced type faces can be used.
-
Characters from the keyboard can be processed as they are typed.
-
Images can be read from files and written to files.
-
Buttons, sliders, and other interface tools are available.