I keep seeing Nim and it looks really productive and very interesting! Does anyone know how it compares to Zig?
Zig supports zero-effort C binding by reusing existing C headers instead of wrapping them^. The only other language known to me having such feature while not actually being a superset of C is Terra†. I feel like we are still several light years away from the Holy Grail of programming languages, which would retain full compatibility while also being extremely productive. Walter Bright (the creator of DLang) once state…
Ray Tracing in Nim
61–68 of 68 posts
Re: Ray Tracing in Nim
#62Has anyone had any luck reproducing the benchmark figures given for the smallpt program? When I try, gcc handily beats nim in the multi-threaded scenario and they are neck and neck in the single-threaded one. For 10 samples per pixel: g++ multi-threaded : 33.52 nim multi-threaded : 36.90 g++ single-threaded: 75.78 nim single-threaded: 75.95 nim 1.2.0, g++ 10.1.0. I used the flags -O3 -march=native -mtune=native -Wall…
Re: Ray Tracing in Nim
#63With all due respect, Nim is a great language performance wise however I fail to see how is it different from D. Many advertised features have been present in D for a long time. Syntax wise Nim it is a step back. It's hard to read and understand while any C/C++ dev will have next to no effort reading through D code. And of course while D is C ABI compliant it interoperates with C++ well too. I seriously doubt that Ni…
> Syntax wise Nim it is a step back. It's hard to read and understand while any C/C++ dev will have next to no effort reading through D code. And of course while D is C ABI compliant it interoperates with C++ well too. On the other hand, people coming from Python, Ruby, Pascal, Ada will appreciate the minimal amount of sigils. > I seriously doubt that Nim or any other language in this regard has better metaprogrammin…
That said, it can do all of the metaprogramming-related tasks you mention.
Re: Ray Tracing in Nim
#64Is this not a concern? Or is Nim fully vetted, that it doesn’t use defective C libraries?
Re: Ray Tracing in Nim
#65Earlier quoted context omitted.
> Syntax wise Nim it is a step back. It's hard to read and understand while any C/C++ dev will have next to no effort reading through D code. And of course while D is C ABI compliant it interoperates with C++ well too. On the other hand, people coming from Python, Ruby, Pascal, Ada will appreciate the minimal amount of sigils. > I seriously doubt that Nim or any other language in this regard has better metaprogrammin…
I suspect d's metaprogramming is not as good as nim's (haven't used the latter), though it's better than metaprogramming of every language I've used without macros. That said, it can do all of the metaprogramming-related tasks you mention.
Re: Ray Tracing in Nim
#66Earlier quoted context omitted.
I suspect d's metaprogramming is not as good as nim's (haven't used the latter), though it's better than metaprogramming of every language I've used without macros. That said, it can do all of the metaprogramming-related tasks you mention.
Are you aware of D libraries in that vein? I'm especially interested in the first 2, since those are something I'm actively working on at the moment.
enum x = BigInt("0xffffffffffffffffffffffffffffffff") % 2;
writeln(x);
('enum' means 'make this value a compile-time constant; error if you can't')Re: Ray Tracing in Nim
#67Earlier quoted context omitted.
If they’re data centric, would you not be better off with vanilla python? If you have numpy do the heavy lifting, it’ll be as fast plus all the syntactic/ecosystem benefits
Numpy is nice but pure-Nim applications appear to outperform it easily: https://narimiran.github.io/2018/05/10/python-numpy-nim.html https://github.com/mratsim/Arraymancer
I think if this were on the order of minutes/hours you would see numpy outperform.
Re: Ray Tracing in Nim
#68Anyone have thoughts on nim vs rust for data centric (Scala like) applications
That depends on why you use Scala? Do you use Scala as a better Java? If so, Nim may be what you want. Do you use Scala for its incredible type system? Rust may be what you want. Do you use Scala for its functional tendencies? Rust may be what you want. As an aside, I've found that once you get over the Rust learning curve, writing 'correct' programs is easier in Rust than any other language I've used. And for data c…