Introducing NaaN

Introducing NaaN

Making Programming Fun

A good software environment makes programming fun. NaaN strives to be the easiest, most enjoyable path for creatively expressing your software ideas.

NaaN is a dynamically typed LISP dialect with a familiar curly-braces syntax. It runs efficiently on phones and tablets, servers and desktops, and anywhere that JavaScript is available. Transparent interop gives NaaN access to millions of libraries on NPM. The system includes NaanIDE™, a web-based IDE with inbuilt make, GUI debugger, and a variety of storage and publishing options.

NaaN Features

  • The NaaN execution model is inherently concurrent, without requiring async/await declarations. When execution is blocked its continuation is suspended, forming a fiber that maintains execution state while waiting.
  • An interruptible foreground enables long-duration batch operations, while future, wait, signal, and sprint primitives provide synchronization among fibers.
  • Remote evaluation is integrated with dynamically spawned worker threads for true multiprocessing of both local and remote CPU-intensive tasks. Automatic task allocation distributes varying workloads.
  • Surface languages are compiled into underlying LISP S-expressions for execution. Decompilation on the fly provides source level debugging in any available language without source file availability.
  • A dialect and language extension facility allows for customized syntax and additional functionality. Creating a new dialect requires just a few lines of code.
  • LISP datatypes include symbols, immutable tuples, dictionaries, and dynamic class-based objects. It includes functions, closures, and macros with both lexical and dynamic variable binding.
  • NaaN enforces strict modularity using namespaces, which allows unrelated software to coexist. Procedures can only write to their own namespace, making it easier to reason about variable mutation while preventing a large class of bugs.
  • NaaN uses ordinary JavaScript datatypes and their methods, so all standard JavaScript string, regex, math, and numeric methods are available.
  • The entire state of a NaaN instance can be saved and restored, including in-progress execution. This is particularly useful for caching complex configurations.

Development of NaaN began in 2017. The first commercial application was DAS in 2018, a proprietary software quality analysis console based on NodeJS with a browser-based UI. Current projects include the NaanIDE integrated development environment, a variety of proprietary systems, and AskHow.app, a mobile-first vertical video micro course platform.

Live Demonstration

It has been traditional since K&R to show a Hello World program when introducing a new programming language. Here is a NaaN example:

If you are wondering why the Hello World text is shown twice, it's because this is a REPL and every NaaN expression has a value. The printline call both outputs text to the terminal and returns it as a value, where it becomes the result of the hw() expression. This is assigned to the symbol $ and displayed by the REPL in its quoted form.

Naan Terminal is interactive, so please experiment. For example, typing hw.proc;> into the REPL prints the S-expression implementation of the function. The up and down arrows navigate through the command history, while ⌘K or ^K will clear the terminal screen.

If you wish to investigate further, the NaaN interpreter and NaanIDE are available under the MIT license. Otherwise please stay tuned for additional posts with more information.

Design Origins

NaaN is based on LISP because it provides an elegant model of computation, which makes it fun to use. This assertion requires some explanation.

At its best software provides an infinite, flexible palette for creativity. You should be able to express your ideas as quickly as you can think of them, and then restructure easily to match your evolving concepts. This is fun. Unfortunately there is an opposing force, complexity, which can completely stall the creative process. This is not fun. Software elegance can be defined as the ratio of creative power to complexity, and elegance is the goal.

The best way to build an elegant system is to start small and evolve it carefully.

Large "Big Bang" software development projects are rarely successful. These start with voluminous specifications, which as they are implemented interact and conflict in unexpected ways that preclude achieving the original objectives. Fixing these conflicts only introduces new ones. The difficulties increase exponentially or even hyperbolically with the size of the system.

Evolving a small system linearly and incrementally allows each change to be crafted for improving the whole. Adding better ways to do things allows existing functions to become simpler and more powerful. This turns the liability of size into a virtue, where each addition provides more benefit than it costs in complexity. Occasional restructuring may still be necessary, but over a smaller area. You may end up with a big system, but it's one that works.

NaaN started with LISP because it offered a lot of room to grow, and NaaN has grown considerably in its 7 years.

Special thanks to Conrad Barski, M.D. for the LISP creature image.

Richard Zulch

Richard Zulch

Richard C. Zulch is a technologist and inventor, and been a founder, developer, and CTO. He has deeply analyzed the software of over 100 startups for M&A investors, strongly informing NaaN's design.
San Francisco Bay Area, California