D and Nim

Elie Morisse via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 4 15:32:46 PST 2015


On Sunday, 4 January 2015 at 18:10:52 UTC, Jonathan wrote:
> Hey folks,
>
> I've been recently checking out Nim/rod and feel like it takes 
> a lot of inspiration from D (I think the creator was in the D 
> community too as some point). How do you think it compares? 
> What areas does D, in principle, makes it a better choice? To 
> give you my background, I like creating games (mostly using SDL 
> bindings) using new languages, aiming for the most efficient 
> yet concise way to write the engine and game logic.
>
> FYI, this is NOT a language war thread. I'm just curious about 
> what separates them from a principle level.

D and Nim have similar goals (conciseness, CTFE, other advanced 
metaprogramming features to reduce code redundancies to zero..), 
but although Nim has cool ideas it's not without some drawbacks:

- Only limited polymorphism, Nim doesn't use virtual tables but 
dispatch trees for performance, and that means that you can't 
have "opaque" base classes running derived methods if the 
overriding methods are unknown to the compiler:

  http://nim-lang.org/manual.html#multi-methods
  http://forum.nimrod-lang.org/t/278

- No conditional evaluation of code
- No type traits
- Declarations are order-dependent
- Generics are redundant with templates (they are going to be 
removed though: http://forum.nimrod-lang.org/t/638 )

IMHO the two languages are similar but D is more advanced, and 
apart from AST macros I don't see any notable appealing features 
from Nim compared to D.


More information about the Digitalmars-d mailing list