6

Recently I was searching for icons(graphics), but I see a link that was very intersting, was a language called Icon, then I want to know:

  • There is someone here that have already tried to develop in Icon?
  • It's a compiled or interpreted language?
  • What are the pros and cons of this language?
  • In which area it's better than some other languages(garbage collection...)?
3
  • So the accepted answer will basically be someone saying, "Yes, I have"?
    – random
    Nov 14, 2009 at 13:45
  • 1
    Now that you've turned the body into an actual question, I would suggest changing the title to "What are the pros and cons of the Icon programming language" or similar
    – Paul Dixon
    Nov 14, 2009 at 13:48
  • 1
    Pity, I answered the original question :P
    – Abel
    Nov 14, 2009 at 13:53

6 Answers 6

10

I know this is a reallllly late reply, but I just had to speak.

It's a gorgeous language. It's one of those languages that you try, and if you /get/ it, you'll be wrapped. I've used it for a very serious and key internal product at a company, and it served admirably. I call it my favorite language; it's just fun to use and really productive when used for the right tasks.

My first curiosity/could-be-useful-if-it-works project was a translator from F77 to C. My first cut was crap and slow, and my second attempt some time later was sweeter and fast - that was when I really started to exploit the string scanning properly. I never did complete this long-lost project because it became irrelevant; I stopped working with some engineers who kept trying to convince me that FORTRAN was good.

It's clear that people like Larry Wall and Guido van Rossum know Icon and Unicon. How well they know it I can't say, but I'd wager fairly well since they seem to be language nuts. The influence is being felt. Icon and Unicon are sort of like a Velvet Underground or Captain Beefheart of the music world; it's not mainstream by a long shot, but people in the know know them and are strongly influenced.

By the way, unlike VU or Beefheart, (Un)Icon doesn't get it's merit from being too grating for ordinary people to handle, so the analogy breaks down badly in this regard... In fact, the syntax and all it's features are very clean and pleasing to the eye. Any resemblance to Pascal is superficial. The syntax sure as hell looks like Pascal to the untrained eye, but behaviorally it's poles apart.

Where does it fit? It won't compete with C for hard-core high performance coding, but that's just like most languages which can't beat C when sheer CPU performance is the only solution. It can't beat Perl's massive collection of libraries in CPAN, but that's probably the only thing in Perl that smokes it! Hell, if you want something that CPAN offers, rewrite and donate it to the Unicon repository. It doesn't have anything like Java's security model, but that's just like most other languages. You probably get the point now.

I started with Icon then shifted several years later to Unicon, which is where the main activity is these days. Icon is being kept "stable, clean and complete" as it stands. Unicon brought together a bunch of extensions and turned it into a cohesive project. The most important being much better coverage of the standard O/S calls, and a full duck-typing OO system.

Unicon's OO even supports circular inheritance, let alone MI! That's mostly for the brain-f**k but also because it proved to be workable. Of course, any sensible programmer generally shouldn't get that stupid unless they are really implementing something in Maths (eg Polar < Cartesian < Polar < Cartesian < ...) or Quantum Mechanics (eg Wave < Particle < Wave < Particle < ...) which are the typical examples showing the rare merit of circular inheritance.

To answer the easy question first, yes, it's compiled, but to a kind of PCODE, which is then executed by a virtual machine. The constructed executables have a hash-bang header so they can be executed directly. On Windows, they have a .EXE header (or is it .COM?) so they can also be executed directly. Needless to say, these are not portable between Unix and Windows, although Powershell might be able to do something to allow the Unix executables to be run directly on Windows. In practice, the compile step is mighty fast and handled by ordinary makefiles. Unicon also has a quick-n-dirty compile-n-run step for messing around, but any project beyond a total roughie is better served with a make phase.

Networking features are part of Unicon. A portable graphics library was available to Icon for a long time, and are also part of Unicon. Garbage collection is a given since it's a very high level language.

The two most important unique features are it's generators and it's string scanning. I won't go into these - it's better you download and have a play through the tutorials until it sinks in. Once generators are available to a language, the string scanning works beautifully. I don't think string scanning could work so neatly without it. Once again, play until it makes sense. It's a very interesting and powerful alternative to using regular expressions, and it was a crucial part of my work.

Generators are one of those things that is begging to be put in any new language. The fact that it's not on the radar is a tragedy IMHO. If I was to seriously sit down and dream of producing the next popular open source language, this would be part of the core. But who has the time? I've got bills to pay.

The most recent versions around 2012+ now have true multi-threading, and are probably stable as I write this.

The Windows builds are basically up-to-date these days in Unicon. Windows build has been sorted out, and I have successfully put my major projects onto Windows with very little grief beyond the obvious grief of having to use Windows.

8

It is a very old programming language (1977), intriguing to see it popping up again. I can't remember having ever seen anything written in it, other then experimental or educational scripts. Wikipedia has some information for you.

One of its descendants, Unicon (see also on Unicon on Wikipedia), has been used at my last employer for building in-house applications. They used it for 3D design (see also this paper). So I know for a fact that it was used, but I can't say I actively used it myself.

EDIT: you edited your question with some more questions, here are some more answers:

  • There is someone here that have already tried to develop in Icon?
    Possibly, but it is primarily an educational language used at universities

  • It's a compiled or interpreted language?
    It is compiled

  • What are the pros and cons of this language?
    It is a very-high-level-programming language, and is supposedly very good with strings and higher structures, but many novel things of Icon have since appeared in other languages. You can't really see the language as anything more then scientific, though it's good at doing graphics and strings

  • In which area it's better than some other languages(garbage collection...)?
    Icon is hard to replace with another language because it is rather unique. Garbage collection is not something you need to worry about, but if you program today in Java, C#, Rebol or Ruby, then Icon may be a nice interruption, but probably won't replace your current popular langauges

In other words: enjoy the ride, download it, try it out, be amazed and then leave it again. Place it on your resume under "other languages" but don't expect it to make too much of an impression ;-)

PS: it is a language that you'll easily master in the rare occasion you'll encounter it in real life projects (likelier it'll be Unicon, though).

3

I've used Icon for what seems forever, and still use it today. It is a successor to "Snobol" and Snobol's successor, Spitbol ("a speedy implementation of Snobol"). It has an Algol like syntax (as does C and lots of other variants) and is distinguished by build in "magic memory" (hash tables) which are supported by their own distinctive syntax. Much of what you may have seen in Icon in the past now appears elsewhere. An example, in Icon, abc["xyz"] is a hashed index into hash table (in Icon, a "table"), here abc, with a key, xyz. Javascript has a similarly syntaxed object property reference. It also has built in lists, co-routines, recursion (every decent language has recursion), arbitrary sized integers, and, string parsing with backup through alternatives - probably the most powerful and useful part of the language. I use it today to replace shell scripts that need intensive string/hash processing. In a former life years ago, I wrote a C-language add-on to Icon that interfaced with Oracle. It does lack the myriad of functions that come built in with, say, PHP or Python or the standard C library. But, I would guess, for the vast majority of coding I've ever done with it, they were not needed anyway. It's quick to code in and readable. As with any other language, you pick it when the programming shoe fits. Another interesting program in Icon that I recall was a simple translator from Ingress' styel of SQL into Oracle's. You can even use it for CGI programming. When there is a match of needs to capabilities, it is fast to program, easy to use, and, believe it or not, fun to use. It has not been extended for years (except for Unicon), but neither has ksh (or its look alike bash).

2

Yes, I have used Icon and found it to be an interesting language. In particular, it has a yield operator which allows a subroutine to return a possible answer, but to keep its state in case another answer is required. Among other things, this makes coroutines and other interesting things possible to be implemented cleanly.

1
  • many languages have a yield operator Feb 24, 2013 at 2:02
2

it's discussed here - http://lambda-the-ultimate.org/node/136

unicon is a more popular, extended implementation (it is a fork of icon that is better supported and has objects) - http://unicon.sourceforge.net/index.html

i haven't used it, but i know that it has quite a long history - it never became very popular but its use of generators influenced languages like python.

see also

unicon includes an interpreter and a compiler for both icon and unicon languages - http://unicon.org/utr/utr11.html

also, it's supposed to be particular good at string processing.

0

It resembles Pascal. You have to compile it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.