Lably
Skip to content

Nim (programming language)

Programming language

  • 43 min read
  • 9 chapters

Related on Lably

Through High-level programming language, Message passing and Object-oriented programming

Description

Nim is statically typed. It supports compile-time metaprogramming features such as syntactic macros and term rewriting macros. Term rewriting macros enable library implementations of common data structures, such as bignums and matrices, to be implemented efficiently and with syntactic integration, as if they were built-in language facilities. Iterators are supported and can be used as first class entities, as can functions, allowing for the use of functional programming methods. Object-oriented programming is supported by inheritance and multiple dispatch. Functions can be generic and overloaded, and generics are further enhanced by Nim's support for type classes. Operator overloading is also supported. Nim includes multiple tunable memory management strategies, including tracing garbage collection, reference counting, and fully manual systems, with the default being deterministic reference counting with optimizations via move semantics and cycle collection via trial deletion.

[Nim] ... presents a most original design that straddles Pascal and Python and compiles to C code or JavaScript.

— Andrew Binstock, editor-in-chief of Dr. Dobb's Journal, 2014

As of August 2023, Nim compiles to C, C++, JavaScript, Objective-C, and LLVM.

Sign in to keep reading

8 more chapters are free with a Lably account.

More in Computing and communication