Content deleted Content added
This information is useless here. Pascal also has such a result variable. |
+Libraries |
||
Line 32:
== Description ==
Nim is a statically typed programming language with a simple syntax.<ref name="Nim Syntax">{{cite web|url=https://akehrer.github.io/nim/2015/01/05/getting-started-with-nim.html|title=Nim Syntax|work=akehrer|accessdate=2015-03-27}}</ref> Nim supports compile-time metaprogramming features such as syntactic macros and term rewriting macros.<ref name="Nim macros">{{cite web|url=https://en.wikipedia.org/wiki/Macro_(computer_science)#Syntactic_macros|title=Syntactic Macros|work=Wikipedia|accessdate=2015-03-27}}</ref><ref name="manual">{{cite web|url=http://nim-lang.org/manual.html|title=Nim Manual|work=Official website|accessdate=2014-07-20}}</ref> Term rewriting macros enable library implementations of common data structures such as bignums and matrixes to be implemented with an efficiency as if they would have been builtin language facilities. Iterators are supported and can be used as first class entities<ref name="manual"/> in the language as can functions, these features allow for [[functional programming]] to be used. Object oriented programming is supported by inheritance and [[multiple dispatch]]. Functions can be generic and can also be overloaded, generics are further enhanced by the support for type classes. Operator overloading is also supported.<ref name="manual"/> Nim includes [[Garbage collection (computer science)|automatic garbage collection]] based on deferred [[reference counting]] with cycle detection.<ref name="gc">{{cite web|url=http://nim-lang.org/gc.html|title=Nim's Garbage Collector|work=
== Examples ==
Line 81:
</syntaxhighlight>
Existing C code can directly be used in Nim. In this code the well known <code>printf</code> function is imported into Nim and subsequently used.<ref name="special">{{cite web|url=http://hookrace.net/blog/what-is-special-about-nim/|title=What is special about Nim?|work=HookRace|date=2015-01-01|accessdate=2015-02-17}}</ref>
== Libraries ==
A Nim program can use any [[Library (computing)|library]] which can be used in a [[C (programming language)|C]] program. There are existing [[Language binding|bindings]] for many libraries, for example [[GTK+]]2, [[Simple DirectMedia Layer|SDL]]2, [[Cairo (graphics)|Cairo]], [[OpenGL]], [[Windows API|WinAPI]], [[zlib]], [[libzip]], [[OpenSSL]] and [[cURL]].<ref name="lib">{{cite web| url=http://nim-lang.org/lib.html | title=Nim Standard Library | work=Nim documentation | accessdate=2015-04-04}}</ref> Nim works with [[PostgreSQL]], [[MySQL]] and [[SQLite]] databases. Nim can interface with the [[Lua]] and [[Python (programming language)|Python]] interpreter. The tool c2nim helps to generate new bindings from C code.
== References ==
|