When comparing Nim vs Idris, the Slant community recommends Nim for most people. In the question“What are the best (productivity-enhancing, well-designed, and concise, rather than just popular or time-tested) programming languages?” Nim is ranked 1st while Idris is ranked 30th. The most important reason people chose Nim is:
There are generics, templates, macros in Nim. They can allow you to write new DSL for your application, or avoid all boilerplate stuff.
Ranked in these QuestionsQuestion Ranking
Pro Great metaprogramming features
Pro Strict typing
Checks your code at compile time.
Pro Easy to read
Nim has a lot of common with Python in terms of syntax. Indentation-based syntax, for/while loops.
Pro Easy to integrate with another languages
You can use Nim with any language that can be interfaced with C. There's a tool which helps you to create new C and C++ bindings for Nim - c2nim.
You don't need to deal with all those manual memory allocations, Nim can take care of it. But also you can use another GC, or tweak it for your real-time application or a game.
Pro Compile-time execution
Nim has a built-in VM, which executes macros and some other code at compile time. For example, you can check if you're on Windows, and Nim will generate code only for it.
Pro Really cross-platform
The same code can be used for web, server, desktop and mobile.
Pro Built-in Unicode support
You can use unicode names for variables, there is "unicode" module for operations with unicode.
Pro Type interferencing
You only need to specify types in your procedures and objects - you don't need to specify type when you're creating a new variable (unless you're creating it without initialization).
Pro Multi paradigm
Imperative, OOP, functional programming in one language.
Pro Has built-in unittest module
With built-in "unittest" module you can create test with a very readable code.
Pro Supports UFCS (Unified Function Call Syntax)
writeLine(stdout, "hello") can be written as stdout.writeLine("hello")
proc add(a: int): int = a + 5 can be used like 6.add.echo or 6.add().echo()
Pro Has built-in async support
Nim has "asyncdispatch" module, which allows you to write async applications.
Pro Full dependent types
Idris not only has support for type classes, but is a fully dependently typed language, giving you the full power to statically verify your code.
Pro Domain driven design and type driven development
Because of full dependent types in Idris, the programmer can focus more on modelling the domain with types and waste less time fixing common bugs that the type checker will catch. Dependent types help apply type driven development and a lot of code auto generation, making the compiler and type checker an ally in developing working software instead of just getting in the way.
Con Weaker type inference
As type inference is undecidable for dependently-typed languages, Idris cannot offer the full type inference that Haskell supports, and so more type annotations will be needed.
Con Different semantics from Haskell
Idris, while similar to Haskell, has strict semantics, which may cause some confusion if your backend is done in Haskell. If using Idris, it would make sense to do the backend in Idris as well, if not for the fact that Idris currently has fewer libraries available for web development than Haskell.