beanz Magazine

Nim

Nim Website

Flexibility is the most interesting quality of the Nim programming language.

It can be used for scripting, games, compilers, operating systems, and scientific computing. For example, you can use Nim to write your own operators, macros, and templates.

The language also provides a range of programming approaches, from imperative to object oriented to functional to metaprogramming (where a program can manipulate another program).

Where Rust, another recent language, is designed to replace C and C++ by addressing their shortcomings, Nim’s ambitions are to replace C, C++, and Lua. You also might add Python which is often used in scientific computing.

The language is designed to be efficient, elegant, and highly expressive.

What Makes Nim Special?

Nim is a relatively new language created by Andreas Rumpf and released in 2008. It was originally called Nimrod. Rumpf created the language in response to existing languages which required large virtual machines to ship with code, were too dynamic, and compiled their code at run time.

Nim code compiles to C code to provide cross-platform compatability without virtual machine software. Instead of evaluating code when run, Nim code can be compiled into byte code to run faster. Because Nim is compiled to C, the language includes a foreign function interface (FFI) to include C code within Nim code. Programmers also can compile their Nim code to Objective C, for iOS devices.

The broad range of features combined with a mostly simple syntax makes Nim a really interesting language for programmers. For example, despite its flexibility, the language uses indentation like Python and Haskell to let the compiler know how sections of code are related.

Nim also has an interesting flexible notation for writing code. The language uses traditional method or function notation f(x, y) where f is the function name and (x,y) are potential input arguments. However, you also can write f x,y or, if there are no arguments, f. Among other benefits, this flexible notation helps the compiler target Nim code to be converted to JavaScript. The language does keep track of function names, including capitalization, to avoid name conflicts.

It’s also possible to use templates to teach the Nim compiler how to be efficient when compiling your code, for example, to speed up processing of boolean (true or false, on or off) logic and process integer and numbers.

Nim also lets you do parallelism, the simultaneous execution of multiple calculations at the same time. Garbage collection, a key function for memory management in the computer, can be done with and without distinct and separate pointers. The language also is designed to scale with built in sets, strings, enumerations, objects, and arrays.

How is Nim Used?

As a relatively new language in early stages of development, Nim is used in a wide range of places where programmers want to test its features and suitability. This can include scientific computing, creating operating systems, games, scripting, and compilers. While Nim does not yet have the broad adoption of older languages, it does have an active and enthusiastic community. And the flexibility of the language should attract more programmers and more implementations in the future.

Learn More

Nim

http://nim-lang.org/
https://github.com/Araq/Nim
http://nim-lang.org/learn.html
http://nim-lang.org/documentation.html
http://nim-lang.org/question.html
http://forum.nim-lang.org/
http://stackoverflow.com/questions/tagged/nim
http://www.reddit.com/r/nim
http://en.wikipedia.org/wiki/Nim_(programming_language)

Tutorial of the Nim Language

Andreas Rumpf presentation at MIT describing Nimrod, the original name for Nim. Compares and contrasts Nim with other languages.
http://web.mit.edu/nimrod-lang/arch/i386_linux26/doc/tutorial.html

Nim Questions on Quora

http://www.quora.com/Nim-programming-language

Nim versus Rust

http://arthurtw.github.io/2015/01/12/quick-comparison-nim-vs-rust.html

What is Special About Nim?

http://hookrace.net/blog/what-is-special-about-nim/

Also In The August 2015 Issue

In his classroom, he and his students learn together as a community.

These fifth grade students use their genius hours and Trello software to answer tough questions.

Visual storytelling apps are a great way for kids to document and explore their lives.

Raspberry Pi, Arduino, BeagleBone, Micro Bit, Edison, CHIP, and other handheld computers trace their history to board computers used by engineers.

Random Hacks of Kindness, Jr. helps schools and groups host one day hacking events for kids to work with local non-profit groups.

Resources based on teacher recommendations and other sources.

The new Sphero SPRK Edition makes it even easier for teachers, parents, and kids to learn math, robotics, and programming.

Facts, programs, and groups can help girls succeed at STEM careers.

She was in her 30s when she led the team that developed mission critical software used guide the Apollo moon landings.

Learn about and explore the code used to guide Apollo missions.

CRUD is a powerful concept used everywhere in software programming that uses a database.

Links from the bottom of all the August 2015 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for August 2015.

Some thoughts on starting the third year of publishing this magazine and what's new this month.