Earlier quoted context omitted.
Except for perhaps Lisp languages, almost no language makes compile-time computing and code-generation so easy. This allows for some really powerful language features that can be designed as libraries, and puts this power in the hands of "regular developers" rather than only in the hands of template wizards.
Yeah, I really love that at compile time you can meta-program in almost the same language that you use for normal run-time things. I think the comparison to lisp is apt. It almost feels like lisp macros. Think C++ template metaprogramming but much, much easier and thus, seemingly more powerful. It's not that you couldn't do the same in C++, but D's metaprogramming is so much more accessible that it makes you want to…
The reference D compiler is now open source
41–50 of 313 posts
Re: The reference D compiler is now open source
#42Earlier quoted context omitted.
There is no quantitative metric for safety and easyness. If you can afford a garbage collector, D easily wins over Rust. If you really need the safe manual memory management, Rust wins. In between is still a large grey area.
There are plenty of reasons why Rust could win outside of requiring safe manual memory management. It is an expression based language with ad-hoc polymorphism, algebraic data types, hygienic macros, first class functions, and race-free concurrency. I don't use rust because I don't need manual memory management and I require subtype polymorphism for a lot of things, but I choose Scala over D.
Rust's thread model is free from data races (a thread must have exclusive access to a variable in order to write to it), but not from race conditions in general.
Re: The reference D compiler is now open source
#43Earlier quoted context omitted.
We investigated public domain, but that has international legal problems with it. Boost was the best solution.
Do you have any comment son international legal issues with public domain? Is that not recognized in some places?
Re: The reference D compiler is now open source
#44Whats special about D? why should i learn it?
(If I'm going to learn a new system programming language, which one should I pick?)
Re: The reference D compiler is now open source
#45Earlier quoted context omitted.
Yeah, I really love that at compile time you can meta-program in almost the same language that you use for normal run-time things. I think the comparison to lisp is apt. It almost feels like lisp macros. Think C++ template metaprogramming but much, much easier and thus, seemingly more powerful. It's not that you couldn't do the same in C++, but D's metaprogramming is so much more accessible that it makes you want to…
For someone who knows zero about D, but is a total Pythonista, how would you compare the meta-programming facilities?
Well, imagine that all of the things you can do in Python by messing with dunder methods, function decorators, or metaclasses could be precomputed by a compiler and would not even execute at all during runtime. It makes everything really fast at runtime and easy to precompute at compile time.
Re: The reference D compiler is now open source
#46Honestly, since I'm slightly psychotic about these things, this is a kind of huge to me. Part of the reason I never learned D was because the compiler was partly proprietary. Now I have no excuse to avoid learning the language, and that should be fun.
There have been fully open source compiler for D for a long time: LDC and GDC.
Re: The reference D compiler is now open source
#47Whats special about D? why should i learn it?
Re: The reference D compiler is now open source
#48Earlier quoted context omitted.
Yeah, I really love that at compile time you can meta-program in almost the same language that you use for normal run-time things. I think the comparison to lisp is apt. It almost feels like lisp macros. Think C++ template metaprogramming but much, much easier and thus, seemingly more powerful. It's not that you couldn't do the same in C++, but D's metaprogramming is so much more accessible that it makes you want to…
There's plenty you can do with D but not C++, see regex, bitfields, swap member-by-member with checks for mutual pointers, the pegged library for grammars, etc etc.
Re: The reference D compiler is now open source
#49Honestly, since I'm slightly psychotic about these things, this is a kind of huge to me. Part of the reason I never learned D was because the compiler was partly proprietary. Now I have no excuse to avoid learning the language, and that should be fun.
Re: The reference D compiler is now open source
#50Earlier quoted context omitted.
Each of dmd/gdc/ldc has their individual strengths and styles. It's an embarrassment of riches.
> Each of dmd/gdc/ldc has their individual strengths and styles. I'd be really interested to hear a comparison of those from someone experienced with D and its community.
- DMD is by far the D compiler with the shortest compile time. It's actually so fast that it comes with a utility, 'rdmd', which compiles-then-execute a D program. Say goodbye to shell/perl/python scripts, now you can have compile-time checks without an explicit/slow compilation step. We use it for automation tasks.
- GDC is the compiler of choice when it comes to supporting multiple targets and cross-compilation. It closely follows GCC and G++ command line conventions, meaning that using a single properly written Makefile it's easy to target x86/x86_64/arm, GNU/Linux (or Windows, but the mingw support has been in statis for years). Debian comes with pre-compiled arm-targetting GDC compiler. gdb, gcov, and operf work well. The generated code is fast (more than LDC), we use it for heavy computation tasks.