[comp.lang.icon] Why ICON?

mccaugh@s.cs.uiuc.edu (08/25/89)

I have been reading this notesfile for awhile, and must say I am mystified by
its very presence. What is ICON? What is so special about it as a lanaguage
that it merits its own notesfile? So far, most of what I've read has been
about ICON bugs in Amiga! I would appreciate some explanation about the
purpose of this language and whether it is at all worth learning.

kwalker@ARIZONA.EDU ("Kenneth Walker") (08/28/89)

> Date: 25 Aug 89 08:01:00 GMT
> From: m.cs.uiuc.edu!s.cs.uiuc.edu!mccaugh@uxc.cso.uiuc.edu
> 
> I have been reading this notesfile for awhile, and must say I am mystified by
> its very presence. What is ICON?

Here is my standard brief description of Icon.

  Icon is a high level programming language designed for string processing
  and other non-numeric applications (numeric processing can be done, but the
  language and implementation are not tuned for it). Goal-directed evaluation
  with control backtracking is an integral part of the language. However,
  Icon is very different from other languages, such as Prolog, which use
  this evaluation scheme. Icon has a rich set of control structures which
  use and control backtracking. Most of these control structures look and
  act very much like the control structures of more traditional languages,
  allowing Pascal-like programming where the full power of goal-directed
  evaluation is not required. Icon incorporates generators as a natural feature
  within this goal-directed evaluation scheme.
  
  Icon has a flexible run-time type system: variables may take on values of
  any type and automatic type conversions are preformed as needed by
  operations. There are a variety of types including strings, sets, associative
  tables, and lists with positional, queue, and stack access methods. All
  storage management is automatic; garbage collection is performed as needed.

> What is so special about it as a lanaguage
> that it merits its own notesfile? So far, most of what I've read has been
> about ICON bugs in Amiga! I would appreciate some explanation about the
> purpose of this language and whether it is at all worth learning.

I am on the Icon Project, so my opinions are somewhat biased. Perhaps
others of you can comment on what you find to be Icon's strengths
and weaknesses. What do you use Icon for and why? What don't you
use Icon for and why? (Perhaps I will express some of my biased
opinions after others have commented.)

   Ken Walker / Computer Science Dept / Univ of Arizona / Tucson, AZ 85721
   +1 602 621 2858  kwalker@Arizona.EDU   {uunet|allegra|noao}!arizona!kwalker

mark@intek01.UUCP (Mark McWiggins) (08/28/89)

mccaugh@s.cs.uiuc.edu writes:


>I have been reading this notesfile for awhile, and must say I am mystified by
>its very presence. What is ICON? What is so special about it as a lanaguage
>that it merits its own notesfile? So far, most of what I've read has been
>about ICON bugs in Amiga! I would appreciate some explanation about the
>purpose of this language and whether it is at all worth learning.

Icon is the successor to Snobol4, a rather weird and wonderful pattern-matching
language developed by Ralph Griswold et. al., I guess reaching back into the
60's.

Griswold and cohorts took some of the ideas from Snobol and put them into a
more structured, Pascal-ish language.  (Snobol control structures are
unusual.)  I haven't really used it, but I have the book and it looks good.
I've seen a reference recently on automatic generation of compiler BACK ENDS
(not just another parser generator) that was written in Icon, so obviously
some high-powered types find it useful.

I also understand that it runs pretty much everywhere and on everything, and
since it was developed by public money it's pretty much public domain.  (Last
I heard; I'm sure someone will correct me if I'm wrong.)

I've been meaning to look further into Icon myself for a while, and may have
just convinced myself ... :)
-- 
Mark McWiggins			Integration Technologies, Inc. (Intek)
+1 206 455 9935			DISCLAIMER:  I could be wrong ...
1400 112th Ave SE #202		Bellevue WA  98004
uunet!intek01!mark		Ask me about C++!

kca@cbnewsc.ATT.COM (k.c.archie) (08/28/89)

> What do you use Icon for and why? What don't you
> use Icon for and why? 
>    Ken Walker / Computer Science Dept / Univ of Arizona / Tucson, AZ 85721
>    +1 602 621 2858  kwalker@Arizona.EDU   {uunet|allegra|noao}!arizona!kwalker

We used Icon to prototype a new test management system we were developing
several years ago. Since we were experimenting with new testing techniques
we decided to experiment with new development techniques as well. One
of the team members was well versed in Icon and convinced us to try it.

This was a risk as very few people are familiar with Icon. If we
had gotten into schedule problems on a C project, we could
grab dozens of people out of the hallways here to help. Not so with
Icon. But, we found that Icon was simple to pick up, at least a working
knowledge. I found that I could read and modify Icon code even before I
had read the book.

The first release of the system was written largely in Icon and was (and is)
a great success. Nevertheless, we converted it entirely to C over the
first couple of years of its life. This was done for two reasons.
The most important was speed. Since the runtime system is an interpretor,
large Icon programs are rather slow. 

The second reason is that it is easier for new people coming into the 
project to read C code than Icon.
This appears to contradict what I said above about Icon being easy to learn.
That is true but most people here are already well versed in C and it is easier
not to have to teach them a new language.
But the major drawback was speed. If we had had an Icon compiler, we probably
would have left the system in Icon.

A small study indicated that converting Icon to C doubled the size of the
source code and doubled the execution speed.

I am convinced by this that Icon is an excellent language for trying out
ideas before casting them into stone. It could be used for production
code more easily if it had a compiler and if it had easier access to libraries
like curses.

**kent
Kent Archie att!iwtbv!kca

talmage@lti.com (David Talmage) (08/29/89)

> What do you use Icon for and why? What don't you
> use Icon for and why? 
>    Ken Walker / Computer Science Dept / Univ of Arizona / Tucson, AZ 85721
>    +1 602 621 2858  kwalker@Arizona.EDU   {uunet|allegra|noao}!arizona!kwalker

It took me about two minutes to write a useable "strings" finder (a la
UNIX's strings(1)) in Icon.

I've built a travesty generator in Icon.  It's a toy built around a
frequency table.  You feed it a pattern length, n, and a text, say 5000
words from Jay McInerney's _Bright Lights, Big City_, and it prints text
that looks, statistically, as if Jay McInerney wrote it.  The output may
not be intelligible, but it is easily verified that patterns of some length
n occur with the same frequency in the input and the output.  As n
increases, the intelligibility of the output increases and so does the
output's resemblance to the input.

After hours, I'm doing some machine translation experiments in Icon.  My
Amiga now speaks, more or less, Esperanto.  By December, I think I'll have
a (possibly useful) Esperanto-to-English translator.  Would that I were a
student again so I could spend more time on this project!


DT
------------------------------------------------------------------------------
David W. Talmage, Systems Programmer		...!{buita,bbn}!lti!talmage
Language Technology, Inc.			talmage%lti.uucp@bu-it.bu.edu
27 Congress St., Salem, MA 01970		(508) 741-1507

jeff@aiai.edinburgh.ac.UK (Jeff Dalton) (08/30/89)

> What do you use Icon for and why? What don't you
> use Icon for and why? 

I like Icon, but I don't use it very much because it's not (or at least
wasn't) interactive.  I like to be able to define and call procedures
interactively, like I can in Lisp or Prolog.

vicc@unix.cie.rpi.edu (VICC Project (Rose)) (09/10/89)

In article <8908271943.AA28708@megaron.arizona.edu>, kwalker@ARIZONA.EDU ("Kenneth Walker") writes:
> > What is so special about it as a lanaguage
> > that it merits its own notesfile? So far, most of what I've read has been
> > about ICON bugs in Amiga! I would appreciate some explanation about the
> > purpose of this language and whether it is at all worth learning.

Why does it have its own newsgroup? Well since it is a government funded
research project I think many people are interested in being able contibute
ideas. It is also handy to have a newsgroup for each language.

> I am on the Icon Project, so my opinions are somewhat biased. Perhaps
> others of you can comment on what you find to be Icon's strengths
> and weaknesses. What do you use Icon for and why? What don't you
> use Icon for and why? (Perhaps I will express some of my biased
> opinions after others have commented.)

Why do I use Icon?

Well, I use Icon because I like to experiment with neat computer languages
and Icon is one, and (wow neato!) it is almost free (duplication and mailing
costs only - or FTP, of course you still have to shell out $30 for the manual
but a total cost of $50 for a language of this power is just spectacular. And
gee, if you are interested in compiler design etc, the source plus a book
describing the implementation may be had for a total cost of $80 or so.

What do I program with it? Well one of my interests is writing text adventure
games. A major feature of such games is a parser, it took me about 50 hours
to write a decent parser in Icon, when I wrote in Pascal, it took me almost
that long to write a very trivial parser. When I decided I wanted the program
to word wrap its output, it took me 1 hour to write a word wrap routine.

Another advantage of Icon: its extremely portable! True there are very few
I/O procedures (such as graphics, cursor control {although maybe this is
available on bigger systems?}, sound etc) but the bulk of the code is
completely portable (well except co-expressions if your target doesn't support
them). A developer who desired more fancy I/O could easily get the source code
and add the procedures he needed and then for porting considerations, carefully
control where these non-standard procedures are used. Since Icon is in the
public domain, the modified executor could be distributed with programs.

On the subject of portability I have a few questions:

   are executable images (.ICX) portable to all machines?

   how about some way to allow a standard call to included assembly language
   routines (or .OBJ type files from compilers)? Is this what personalized
   interpreters allow? If so could this feature be ported to the micro domain?

   how about a standard of some sort for system calls with some standardization
   for particular calls such as something like -

       syscall("movecursor",x,y)

          where x and y would be from 1 to n and translated as required, errors
          would be the result if the particular system did not support cursor
          addressing.

   along with this a variable &syscalls which listed the featured syscalls in
   the particular implementation (and perhaps any limits)

    the problem I see (with examples from the IBM-PC) is how to deal with the
    fact that micros will always come out with some usefull system call which
    does not yet have a standard name. How does that get standardized? Also
    how do you select between BIOS and DOS calls. BIOS calls are often faster
    but DOS calls are more portable, then of course one also has the choice
    of using ANSI codes and ANSI.SYS.

    Examples of some calls are the wealth of different keyboard and screen
    calls on the PC.

    Perhaps this is best left to commercial versions of the language, but I
    would like to see support of system calls in the general Icon langauge.
    Of course another problem is what do these system calls relate to in
    the Unix and VMS world? I guess movecursor etc would map to curses calls
    in Unix (I have no programming experience inm Unix, just dropping buzz
    words here).

    I also realize that system calls are of low priority to the Icon project.
The Icon project is concerned with new language concepts, not how do you
create a portable screen I/O system which supports more than teletype level
of display control.

Frank Filz

kwalker@ARIZONA.EDU ("Kenneth Walker") (09/12/89)

> Date: 10 Sep 89 15:26:23 GMT
> From: gem.mps.ohio-state.edu!rpi!unix.cie.rpi.edu!vicc@tut.cis.ohio-state.edu  (VICC Project (Rose))
> 
> On the subject of portability I have a few questions:
> 
>    are executable images (.ICX) portable to all machines?

Without investigating too thoroughly, I believe there are a number of
problems preventing an i-code file from being executed by the iconx
intepreters on differenct machines. Numeric constants are stored in
the files in binary form. Thus differnt byte ordering within integers
will cause problems as will different floating point formats. There
may also be problems with different data sizes between some systems.
I-code files on Unix systems have an executable header which finds
and invokes iconx. This header prevents these i-code files from
being used on systems without them or on systems with different sized
headers. There may be other portability problems, though none come to
mind at the moment.

>    how about some way to allow a standard call to included assembly language
>    routines (or .OBJ type files from compilers)? Is this what personalized
>    interpreters allow? If so could this feature be ported to the micro domain?

The assmebly language (or C or Pascal or ...) routine must be called from
iconx. This means that either you need a dynamic linking facility or you
must relink iconx to specifically include the routine. In addition, any time
you do ``mixed language programming'', you may have to translate data from
the internal format of one language to that of the other. Iconx is written
in C. Becuase values in Icon include type information, even simple Icon types
do not map into primative C types; structures must be used. The present
method for adding a new function to Icon is to write a C routine which
manipulates the structures used to implement Icon types and to tell
icont/iconx about the new routine. On most systems, these C routines may
call routines in written other languages. The personalized interpreter
system just provides a way to compile and link a modified iconx without
making a copy of the entire source. If you want the source for several
modifications of Icon on one system, it will save you disk space, but
does nothing else.

>    how about a standard of some sort for system calls with some standardization
>    for particular calls such as something like -
> 
>        syscall("movecursor",x,y)

This sort of thing would certainly be useful, though it probably won't
get done by the Icon Project.

   Ken Walker / Computer Science Dept / Univ of Arizona / Tucson, AZ 85721
   +1 602 621 2858  kwalker@Arizona.EDU   {uunet|allegra|noao}!arizona!kwalker