News for hackers. Stuff that matters.
Re:Programming in D – Tutorial and Reference by qznc on Friday August 28, 2015 @06:19PM (#10138146)
Advantages compared to ...

Go: Generic type-safe highly efficient code. Can go lower-level like inline assembly. Can go higher-level because more meta programming.

Python: Faster. Static typing.

Ruby: See Python.

Java: Less boilerplate. More control over memory management. More meta programming. Natively compiled.

Rust: Easier. Garbage collection makes programming just as safe and is easier to use. Looks and feels more like C/C++/Java, if you already know them. More meta programming.

(of course, downsides of D are omitted ;)

Re:Programming in D – Tutorial and Reference by pcwalton on Saturday August 29, 2015 @12:06AM (#10139021)
Rust's safety is not limited to memory safety; you get data race freedom too. But the memory safety is the same (assuming you opt into SafeD).
Re:Programming in D – Tutorial and Reference by pjmlp on Saturday August 29, 2015 @01:42AM (#10139202)
Java is also native compiled. Language != Implementation.

OpenJDK is only the reference implementation. There are plenty of commercial implementations with AOT compilers.

Edit: did not write != properly

Re:Programming in D – Tutorial and Reference by qznc on Saturday August 29, 2015 @03:18AM (#10139356)
Yes, but it shows that the language was designed for interpretation. E.g. lazy static initializers is weird in AOT compilation.
Re:Programming in D – Tutorial and Reference by pjmlp on Saturday August 29, 2015 @03:27AM (#10139363)
It is not weird in functional programming languages.
Re:Programming in D – Tutorial and Reference by qznc on Sunday August 30, 2015 @05:17PM (#10144508)
I think you misunderstood me, because I used "lazy". It has nothing to do with Haskell lazyness.

In Java static fields are initialized when a class is loaded by the class loader. A class is only loaded when used. If anything (IO,scheduler,etc) changes the order in which classes are used, then initializers are called in a different order and their side effects as well. This semantic is mandatory by language definition.

In a Java AOT compiler this means every access to a static field must be prefixed with a (synchronized) check if the class is already initialized and optimizing it away is rarely possible. A JIT compiler does not even care, because it knows the class is already loaded.

For contrast, in C++ static fields are all initialized before main is called.

Re:Programming in D – Tutorial and Reference by pjmlp on Monday August 31, 2015 @07:14AM (#10146275)
Actually I don't know how the current AOT compilers approach that situation.

Now with Oracle taking the steps to eventually make AOT compilation also a feature in the reference JDK, I suppose whatever issues might still exist they will be tackled.

Re:Programming in D – Tutorial and Reference by NhanH on Saturday August 29, 2015 @05:37AM (#10139511)
Can you expand on the downside part of D?
Re:Programming in D – Tutorial and Reference by qznc on Saturday August 29, 2015 @07:56AM (#10139725)
Downsides compared to ...

All of them: Language is more complex and takes longer to learn. Less community. Less libraries.

Python: D cannot be as close to pseudo code, mostly due to static types.

Rust: Borrow checking looks like a nice idea. The question is, if the cost is worth it.

As a language, I think D is clearly better than Java and Go. Go has better tooling. For example, go-fmt is production quality, while dfmt is alpha quality.