Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No, you can just write D. It'll have the same performance as C, if you write C-like code. It might have better performance than C if you use templates (just like in C++).




But why then did arcadia_leak imply as far as I understood him that C is needed for performance in D?

But D is not included in the benchmarks game at debian.net, which isn't fair to D either as far as I can tell.


You can use C but you are not forced to. In fact, you can write C and convert it automatically to D (though it will need some amount of manual editing afterwards). C is supported as a syntax option but it's still the same compiler for both under the hood. As rightly pointed out by the user above, you can write the same high performance code in the D syntax. The reverse is not true, though -- using high level concepts like classes and GC allocation is not supported in the C syntax.


Not necessarily, you can just call the functions in the C library from D as you'd call them from C or C++ with the added benefit of being able to leverage the D GC, RAII, macros etc.

https://dlang.org/spec/interfaceToC.html

Dunno about the Debian benchmarks game or their build environment. I did my own benchmarks and it was quite easy to write working D code compared to C, C++ or Rust. I used LDC, the LLVM D compliler as opposed to DMD. Dub is not that seamless compared to Cargo but given that you have to set things up manually, it doesn't encourage dependency hell.

If you're writing networking code, Go is probably a better choice than vibe.d.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: