Unicon
A unified extended dialect of Icon that adds classes, POSIX system facilities, networking, databases, and 3D graphics to goal-directed programming
Created by Clinton Jeffery
Unicon - the Unified Extended Dialect of Icon - is a very high-level, goal-directed, object-oriented, general-purpose language descended from Icon. Where Icon focused narrowly on elegant string processing and its famous success/failure evaluation model, Unicon grafts on the machinery of a practical applications language: classes and packages, a POSIX system interface, networking, database access, and integrated 2D/3D graphics. It is, in effect, the answer to the question “what would Icon look like if it grew up into a general-purpose language?”
History & Origins
Unicon’s story begins with Icon, created by Ralph Griswold at the University of Arizona starting in 1977. Icon was beloved for its generators, goal-directed evaluation, and string scanning, but it was deliberately minimalist about the outside world: no object-orientation, limited operating system access, and no networking.
Three independent extensions to Icon changed that:
- Idol - an object-oriented dialect of Icon that Clinton Jeffery developed in the early 1990s. Idol was implemented as a preprocessor that translated classes and inheritance into plain Icon code, with no support from the underlying runtime.
- POSIX extensions - Shamim Mohamed wrote a set of POSIX filesystem and networking extensions for Icon. This package was the original bearer of the name “Unicon” (as in UNIX + Icon), before the name was broadened to describe the whole language.
- ODBC facility - Federico Balbi contributed database connectivity through ODBC.
In the late 1990s these strands were merged into a single, coherent superset of Icon. Rather than a preprocessor bolted onto Icon, the unified language gained real runtime support for objects, which simplified the notation and - according to the project’s own account - made object-related operations faster than the old preprocessor translation. The book Programming with Unicon, by Jeffery, Mohamed, Robert Parlett, and Ray Pereda, carries a copyright beginning in 1999, and the site’s own Icon history marks 1999 as the year the Unicon project emerged. Drafts of the book circulated as free online documents from 2000 onward, and it remains freely available today, now in its second edition.
The Unicon developers were careful to frame the project as a friendly continuation, not a fork in anger: they cooperated with the University of Arizona’s Icon Project, and Unicon remains substantially backward-compatible with Icon source code. Later contributors include Jafar Al Gharaibeh, who built Unicon’s concurrency and 3D graphics facilities.
Design Philosophy
Unicon keeps Icon’s two most radical ideas intact:
- Goal-directed evaluation. Expressions do not merely compute values - they succeed or fail, and failure drives control flow. There are no boolean flags to check; a failed expression simply produces no result.
- Generators. Any expression may produce a sequence of values, and the language automatically backtracks through alternatives to find one that makes the surrounding expression succeed.
On top of this foundation, Unicon’s designers added what real applications need, guided by a pragmatic principle: the purpose of object-orientation is to enhance Icon’s expressive notation, not to get in the way of it. Classes are available when a program grows large enough to need them, but small programs remain as terse as Icon scripts. Unicon advocates objects as a suggestion, not a rule.
The second unifying idea is that system facilities should feel native. Opening a TCP connection uses the same open() function as opening a file; a database connection is traversed like a built-in table; messaging over HTTP or SMTP is part of the language library rather than an external dependency.
Key Features
Everything Icon Has
Unicon is a superset of Icon, so all of Icon’s signature features work unchanged:
procedure main()
# generators + goal-directed evaluation
every write(1 to 5)
# string scanning
s := "key=value"
s ? {
key := tab(find("="))
move(1)
write(key, " -> ", tab(0))
}
end
Classes and Packages
Object-oriented Unicon code looks like this:
class Account(owner, balance)
method deposit(amount)
balance +:= amount
return balance
end
method show()
write(owner, ": ", balance)
end
initially
/balance := 0
end
procedure main()
a := Account("Ada")
a.deposit(100)
a.show()
end
The initially section is a constructor body, and the /balance := 0 idiom - “if balance is null, set it to 0” - shows how naturally Icon’s failure-driven operators carry over into object-oriented code. Unicon supports multiple inheritance with its own novel semantics, and packages provide namespaces for larger systems.
System Interface and Networking
The POSIX heritage shows in how little ceremony system programming requires:
procedure main()
# open a TCP connection like a file
sock := open("example.com:80", "n") | stop("cannot connect")
writes(sock, "GET / HTTP/1.0\r\n\r\n")
while write(read(sock))
end
Unicon programs can fork processes, inspect directories, use DBM and SQL databases through ODBC, and exchange mail or web requests through built-in messaging facilities.
Concurrency
Since the version 12 era, Unicon has supported true concurrent threads on top of POSIX threads, documented in the project’s Unicon Threads User’s Guide and Reference Manual. Threads extend Icon’s co-expressions - the language’s original mechanism for encapsulated computations - into genuinely parallel execution:
procedure main()
workers := []
every i := 1 to 4 do
put(workers, thread work(i))
every wait(!workers)
end
Graphics
Unicon integrates 2D graphics inherited from Icon’s graphics facilities and adds a 3D graphics interface with its own user’s guide and reference manual. The project also ships IVIB, a visual interface builder for constructing GUIs.
Pattern Matching
In 2017 the version 13 line gained SNOBOL-style patterns as a first-class data type, closing a historical loop: Icon was created by SNOBOL’s designer as its successor, deliberately replacing patterns with string scanning - and Unicon eventually welcomed patterns back alongside scanning, letting programmers choose whichever notation fits the problem.
Evolution
Unicon’s version numbering continues Icon’s: Icon’s final major versions were in the 9.x series, and Unicon releases have progressed through versions 11, 12, and 13. Milestones along the way include the ODBC interface (documented in the project’s first technical report in 2002), 3D graphics arriving in the version 11 era, concurrent threads in the version 12 era, and built-in pattern matching in version 13.
Unicon 13.2 was released in December 2020, and version 13.3 is the current version, distributed as rolling releases from the project’s Git repository with binary downloads for Windows. Recent work has included OpenGL-based graphics (UTR 22, 2021) and a JSON library (UTR 20, 2020). The project is licensed under the GNU General Public License and, per the official documentation, builds on Linux, Windows, macOS, Solaris, OpenBSD, and other platforms, across common CPU architectures including i386, amd64, and arm64.
Tooling
For a small-community language, Unicon is unusually well-tooled:
- udb - a source-level debugger
- ui - a Unicon development environment
- IVIB - a visual interface builder
- iyacc and uflex - parser and lexer generators for building languages in Unicon
- Visual Studio Code extensions - Unicon Syntax, Unicon Debugger, and Unicon Helper, all listed in the official repository
Documentation is a particular strength: Programming with Unicon (second edition) and The Implementation of Icon and Unicon: a Compendium are both free, actively maintained PDF books, backed by a numbered series of Unicon Technical Reports.
Current Relevance
Unicon today is a living niche language. Development continues in the open on GitHub under the Unicon Project organization, with the language’s original designer, Clinton Jeffery, still active as maintainer alongside long-time contributors. The community is small but productive - Unicon appears in hundreds of Rosetta Code task solutions, and Jeffery’s 2021 Packt book Build Your Own Programming Language introduced Unicon to a new audience by using it as one of two implementation languages (with Java) for building a compiler from scratch.
Nobody chooses Unicon for its ecosystem size. People choose it because a goal-directed, generator-based language with real system facilities lets certain programs - parsers, text analyzers, network utilities, research prototypes - be written in far less code than a mainstream language would typically need.
Why It Matters
Unicon matters for two reasons. First, it preserved and extended a genuinely different model of computation. Goal-directed evaluation with implicit backtracking exists in almost no other practical imperative language, and Unicon is where that lineage - SNOBOL to Icon to Unicon - remains alive and maintained. Python’s generators were famously inspired by Icon; Unicon shows what a whole language built around that idea looks like when given objects, threads, and sockets.
Second, it is a case study in how a research language becomes a practical one without losing its soul. The Unicon team did not rewrite Icon into a conventional language; they asked what minimal additions would let Icon programmers build servers, GUIs, and databases, and added exactly those. The result is one of the most complete “roads not taken” in programming language history - a fully usable alternative answer to questions that mainstream languages answered differently.
Learning Resources
Online
- Unicon homepage - https://unicon.sourceforge.io/ (also at unicon.org)
- Unicon on GitHub - https://github.com/uniconproject/unicon
- Unicon Technical Reports - https://unicon.sourceforge.io/reports.html
- Rosetta Code Icon/Unicon category - https://rosettacode.org/wiki/Category:Unicon
Books (free PDFs from the project site)
- Programming with Unicon, 2nd edition - Jeffery, Mohamed, Al Gharaibeh, Pereda, and Parlett
- The Implementation of Icon and Unicon: a Compendium - Jeffery et al.
- Build Your Own Programming Language - Clinton Jeffery (Packt, 2021)
Why Learn Unicon?
- Goal-directed thinking: success and failure as control flow will permanently change how you look at conditionals and loops
- Generators at full power: see the idea behind Python’s
yieldas an organizing principle for an entire language - Icon, but practical: everything that makes Icon fascinating, plus the objects, sockets, and databases needed to write real programs
- Language implementation: with iyacc, uflex, and Jeffery’s compiler book, Unicon is a surprisingly pleasant vehicle for building your own language
Timeline
Notable Uses & Legacy
Compiler construction education
Jeffery's book Build Your Own Programming Language implements a working compiler for a Java subset in Unicon, and the project ships its own language-implementation tools, iyacc and uflex, patterned after yacc and lex.
Programming language research
Unicon serves as a research vehicle for work on goal-directed evaluation, program monitoring, and debugging - including UDB, a source-level debugger for Unicon documented in the project technical reports.
Text and data processing
Unicon inherits Icon's string scanning and generators and adds SNOBOL-style pattern matching, making it a natural fit for parsing, log analysis, and text transformation scripts.
Systems and network scripting
The built-in POSIX interface, sockets, and messaging facilities (HTTP, SMTP, POP) let Unicon programs open network connections with the same open() function used for files.
Rosetta Code
Unicon is one of the better-represented small languages on Rosetta Code, where hundreds of programming tasks have Icon/Unicon solutions maintained by the community.