D and Nim
Brian Rogoff via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jan 4 17:12:28 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).
I'm pretty sure that D was not a big inspiration to Nim, even
though Araq (Andreas Rumpf) has commented here on occasion.
> How do you think it compares?
Overall, I much prefer Nim. The obvious first difference is
syntax (Nim uses an offside rule like Python/Haskell/ISWIM) and
for some people that's a huge difference which determines which
they'll prefer.
Nim's parametric polymorphism is less powerful than D's I think
(the words 'generic' and 'template' are used differently in the
two communities so I'll try and be extra clear) but Nim has a
powerful macro system and a (still unfinished) kind of "type
classes" which give it an edge on D.
D has a simple class based OO that looks a lot like Java, and
ties reference semantics to classes. D has a rather unique multi
method based OO system.
There are quite a few more things (concurrency, effect system,
iterators vs ranges, ..) but I'll just advise you to look.
> What areas does D, in principle, makes it a better choice?
Larger language community. Lower bus factor too, I think.
Subjectively, D feels to me like an attempt to fix and improve
C++. Nim feels more like a language in the Delphi/Modula-3
tradition with Python syntax. If you can't stand that syntax,
stay away. It's not changing.
> 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.
Nim's GC was designed with games in mind. D's GC (which can be
disabled) is not usually considered a strong point of the
language implementation.
> FYI, this is NOT a language war thread. I'm just curious about
> what separates them from a principle level.
Quite a lot separates them, even though they both target similar
areas. Best to read a few tutorials and write some small programs
in each. You might also try asking on the Nim forum. I realize
you say you're not starting a language flame war, but the
etiquette of the question is a bit problematic. Hopefully I don't
fan any flames with my answer.
More information about the Digitalmars-d
mailing list