Live data from Hacker News

The reference D compiler is now open source

forum.dlang.org

71–80 of 313 posts

Re: The reference D compiler is now open source

#71
post #44

Whats special about D? why should i learn it?

Also, how does D compare to Rust? (If I'm going to learn a new system programming language, which one should I pick?)

D2, as a language, favourably. As an ecosystem, not favourably.

I REALLY ENJOYED D1, REALLY! (CAPS 11). D1 was like C, but better. It was heavenly. D2 is like C++, but better. Not my cup of tea though. Give it a spin for a day or two. I'm sure you'll like it if you like C++. Trouble arises, as with all niche languages, when you try to move to production and you have to source libraries and/or support.

Re: The reference D compiler is now open source

#73
post #57

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.

Anybody out there that has experience with both Nim and D? I am curious how they both compare in terms of metaprogramming.

I've dabbled with Nim. It's also a great language with great metaprogramming features. Plus a fast compiler that generates very lean code. (The real reason I stick with D over Nim, above all else, is RAII -- once you have it, it's really hard to live without. Okay, that, and also ranges, and array/string slices... they are fantastic to work with. Nim's got a better GC story right now, IMO, but there's a lot of activity in the D community to become more competitive in that space.)

I found that some of the Nim's MP features, in particular AST macros, are a little harder to work with than D's templates and compile-time function evaluation. You get a lot of flexibility, but the cost is high. I'm not a big fan of how "mixin" is used in D to splice source-text into a generated function, it's certainly less principled than an AST transformation, but in practice the resulting code tends to be concise and easily read, whereas the AST-macro approach introduces a lot of accidental "noise" and complexity. The complexity raises the bar for reaching for a compile-time solution, where in D it seems equally as natural to write compile-time code as it does to write regular code. (Not to pick on a strawman, though -- AST macros are not Nim's only MP tool.)

The Nim MP feature I never really played with was the rewrite rules. They seem interesting in theory, but maybe a little too magical for my liking!

I have a lot of respect for Nim. I am glad we live in a world with so many options. Like Walter said in an earlier comment, it's an embarrassment of riches. :)

Re: The reference D compiler is now open source

#74
post #51

Anybody worked on performance critical stuff in D? How good is its GC?

The performance of D is the same as that for the corresponding C/C++ program in the corresponding compiler. dmd and Digital Mars C++ gdc and gcc ldc and clang

I meant the situations when the GC is a bottleneck, and how people deal with it, by fine tuning GC, etc... Any war stories about this...

Re: The reference D compiler is now open source

#75
post #55

Earlier quoted context omitted.

I agree it is valuable. But I still think there are better alternatives now. Depending on your priorities and constraints, OCaml, Go, F#, Scala, and Swift all fit the same description (easier than Rust, safer than C++) and they're in the same realm for performance (slower than C, C++, Rust, etc., but not by much). D could have been there if they had a decade or so with a bigger community.

D certainly has made a few mistakes and having a non-free backend in dmd was one of them. I doubt this could have been avoided though. It was just technical debt, which Symantec now graciously payed off. I have great respect for the Rust people, because it seems they do everything right so far. I am a sucker for language discussions, so let me explain what my problems are with your suggestions. Ocaml: No support for…

yes, ocaml has opam as a package manager now. the community has also grown quite a bit recently.

Re: The reference D compiler is now open source

#76
post #55

Earlier quoted context omitted.

I agree it is valuable. But I still think there are better alternatives now. Depending on your priorities and constraints, OCaml, Go, F#, Scala, and Swift all fit the same description (easier than Rust, safer than C++) and they're in the same realm for performance (slower than C, C++, Rust, etc., but not by much). D could have been there if they had a decade or so with a bigger community.

D certainly has made a few mistakes and having a non-free backend in dmd was one of them. I doubt this could have been avoided though. It was just technical debt, which Symantec now graciously payed off. I have great respect for the Rust people, because it seems they do everything right so far. I am a sucker for language discussions, so let me explain what my problems are with your suggestions. Ocaml: No support for…

[deleted]

Re: The reference D compiler is now open source

#77
post #59

Please don't get me wrong, as I don't want to start a flame here, but why do they call D a "systems programming language" when it uses a GC? Or is it optional? I'm just reading through the docs. They do have a command line option to disable the GC but anyway...this GC thing is, imho, a no-go when it comes to systems programming. It reminds me of Go that started as a "systems programming language" too but later switch…

Why does gc disqualify a language as a system's language? P.S. I think of a system's language as one that runs directly on the machine, e.g. Swift, C, go. They operate at the "system" level.

You can definitely do systems programming with a GC, but it does get in the way sometimes. Drivers will most likely need to bypass it entirely; more importantly, libraries to be embedded in other programs (including scripting languages) now have to deal with two garbage collectors rather than one.

Re: The reference D compiler is now open source

#78
post #62

Earlier quoted context omitted.

Why does gc disqualify a language as a system's language? P.S. I think of a system's language as one that runs directly on the machine, e.g. Swift, C, go. They operate at the "system" level.

Could one write a driver in D?

Here is someone writing a kernel in D: https://github.com/Vild/PowerNex
Post reply on HN