News for hackers. Stuff that matters.
Re:D Language accepted for inclusion in GCC by int_19h on Wednesday June 21, 2017 @04:46PM (#14607785)
I don't think it's meaningful to put Swift, Rust and Go in a single bucket when comparing them. They're languages targeting different levels of abstraction, with very different approaches as a result.

Some people refer to all of these as "better C++", but it's meant in very different and incomparable ways. For example, Rust is ostensibly a "better C++" in a sense that it retains the low-level, zero-overhead (no GC) etc nature and powerful metaprogramming facilities. Go is a ostensibly a "better C++" because it promotes higher-level, safer abstractions that are still "fast enough" (but not zero-overhead). Ditto Swift.

D is arguably in the same bucket as Swift, and partly as Go. I don't think it's very useful to compare and contrast it against Rust. And I think that of all of these, Rust is the only one that can truly claim to be a "better C++" in a meaningful way. Others are "something better than C++ for most apps you'd write in C++ today".

Re:D Language accepted for inclusion in GCC by klickverbot on Wednesday June 21, 2017 @06:02PM (#14608347)
> D is arguably in the same bucket as Swift, and partly as Go. I don't think it's very useful to compare and contrast it against Rust.

It is easy to claim how things "arguably" are, but without providing any justification that is not a very meaningful statement to make.

D very much matches your definition of "low-level, zero-overhead (no GC) etc nature and powerful metaprogramming facilities" – the GC can be avoided easily enough. It can certainly claim to be a "better C++" in this sense. For instance, Weka.IO (a storage startup founded on D) heavily relies on D to offer exactly that, in order to implement a distributed file system with sub-100µs latency.

The fact that you can also write Python-esque code during prototyping (playing fast and loose with the GC, etc.) doesn't detract from the core identity of the language as a tool for systems programming with zero-cost abstractions.

Re:D Language accepted for inclusion in GCC by dgfgfdagasdfgfa on Wednesday June 21, 2017 @06:39PM (#14608591)
How is D's memory safety without the GC? How does it guarantee you don't use-after-free, de-ref nulls, buffer overflow, etc?
Re:D Language accepted for inclusion in GCC by WalterBright on Wednesday June 21, 2017 @07:19PM (#14608857)
Great question! The answer is a bit more than a simple reply can do, so:

Pointers Gone Wild: Memory Safety and D http://dconf.org/2017/talks/bright.html

Re:D Language accepted for inclusion in GCC by hellcatv on Wednesday June 21, 2017 @08:51PM (#14609318)
It seems like use-after-free is still a potential issue, even with those guard rails. Rust deals with those through named lifetimes --would those ideas be useful in D as well?
Re:D Language accepted for inclusion in GCC by dgfgfdagasdfgfa on Wednesday June 21, 2017 @07:31PM (#14608932)
Walter, you're always so responsive in these threads! Cheers.
Re:D Language accepted for inclusion in GCC by mhh__ on Wednesday June 21, 2017 @07:19PM (#14608859)
This is being worked on, but there is already memory safety checks implemented in the compiler (That one can use now) "-dip1000"
Re:D Language accepted for inclusion in GCC by int_19h on Wednesday June 21, 2017 @08:40PM (#14609268)
Is the D standard library GC-free?

If not, then I would posit that it's not correct to say that it matches my definition.

Re:D Language accepted for inclusion in GCC by donatj on Wednesday June 21, 2017 @05:18PM (#14608036)
I will argue that Go is more of a better C than a better C++
Re:D Language accepted for inclusion in GCC by cies on Wednesday June 21, 2017 @07:31PM (#14608928)
Go is more a better Python. Even simpler syntax. Types and compiles to native (as they are all the fashion now).

Rust is the best bet we have at a better C (and a better low-level C++).

High level C++ competes with D and Go. Rust is a little too specifically targetted at the low level "systems" programming.

Re:D Language accepted for inclusion in GCC by int_19h on Wednesday June 21, 2017 @08:41PM (#14609278)
I don't think a "better Python" can be statically typed - dynamic typing, and all the associated runtime tricks that you can do with it, is kinda part of what makes Python distinctive (whether for good or bad, opinions differ there).
Re:D Language accepted for inclusion in GCC by jxub on Thursday June 22, 2017 @06:51AM (#14611298)
Go has this "interface" thing which lets you do duck-typing, and it's checked at run-time, as the types in Python.
Re:D Language accepted for inclusion in GCC by int_19h on Thursday June 22, 2017 @02:51PM (#14614402)
This is consumer-side duck typing. Python also provides producer-side duck typing - you can make any of your objects a duck dynamically, by making them behave like a duck at runtime. I'm not aware of anything similar in Go wrt interfaces.
Re:D Language accepted for inclusion in GCC by jupp0r on Thursday June 22, 2017 @12:37AM (#14610155)
Rust also shines when it comes to high level abstractions. This is what attracts me to the language: as in C++, it covers the super low-level stuff, but it also powerful in business logic abstractions.
Re:D Language accepted for inclusion in GCC by slaymaker1907 on Wednesday June 21, 2017 @10:45PM (#14609776)
Go has far more in common with Java than it does with python. Arcane APIs that are incredibly difficult to use correctly while having a very simple base language.
Re:D Language accepted for inclusion in GCC by krylon on Thursday June 22, 2017 @08:05AM (#14611618)
I found the Go APIs I have worked with far more simple and idiomatic than any Java libraries I have worked with (which is admittedly not a lot).

It is, to a degree a matter of taste, of course, but Go APIs tend to be rather simple, whereas Java libraries seem to often have FileOpenDialogStyleTemplateProcessorFactoryFactory-type interfaces.

The major problem I have with Go currently is lack of function overloading, which means you either have to convert your data around a lot or have many similar functions for different data types that do the same thing (basically), but have different names.

I think the comparison with Python is quite fitting, because both languages encourage a certain way to think about and implementing things. For Python it's called pythonic, in Go it's called idiomatic.

Re:D Language accepted for inclusion in GCC by int_19h on Thursday June 22, 2017 @01:09AM (#14610238)
For my edification, could you give an example of such an API in Go?
Re:D Language accepted for inclusion in GCC by paulddraper on Wednesday June 21, 2017 @06:36PM (#14608558)
And more of a spiritual successor than an actual one.

You probably won't be writing kernels with it.

Re:D Language accepted for inclusion in GCC by throwaway7645 on Wednesday June 21, 2017 @07:05PM (#14608750)
No as Go has a GC. It's just supposed to be a fast server-side language without very complicated code. Go is mostly successful due to Google and filling a niche (fast, simple, concurrent, all thrown into a fat statically linked binary I think).
Re:D Language accepted for inclusion in GCC by pjmlp on Thursday June 22, 2017 @04:06AM (#14610803)
> No as Go has a GC.

So what, so do Oberon, Modula-3 and many others including D.

Yet quite a few production OSes were even written with them, e.g. Native Oberon for the Ceres Workstation at ETHZ.

Re:D Language accepted for inclusion in GCC by throwaway7645 on Thursday June 22, 2017 @06:53AM (#14611302)
I think I'd rather not have GC in my OS. Oberon was a pretty small language, so perhaps the pauses were more acceptable.
Re:D Language accepted for inclusion in GCC by pjmlp on Thursday June 22, 2017 @07:08AM (#14611360)
It even supported live video editing.

Pauses weren't an issue for users' productivity.

Re:D Language accepted for inclusion in GCC by throwaway7645 on Thursday June 22, 2017 @06:02PM (#14615674)
I'd have to know more details to see y that's not a problem. Vastly superior code, or just a very lightweight system.. I dunno.
Re:D Language accepted for inclusion in GCC by pjmlp on Friday June 23, 2017 @03:22AM (#14617510)
What is kind of left from the documentation. There are other sources but this one is easier to refer to.

http://www.ocp.inf.ethz.ch/wiki/Documentation/Front

Video editor playing a video on the lower right corner.

http://www.ocp.inf.ethz.ch/wiki/Documentation/WindowManager?...

Re:D Language accepted for inclusion in GCC by pjmlp on Wednesday June 21, 2017 @05:17PM (#14608032)
> Others are "something better than C++ for most apps you'd write in C++ today".

As big C++ fan and language geek, I am pretty confident that if Java and .NET had taken the route of all other alternatives in the 90's (Oberon, Eiffel, Modula-3, Delphi,...), C and C++ would be less relevant today than they turned out to be.

This because many people make use of them, just because they are the only languages they know about compilers that produce AOT executables, with the option of static linking them.

Maybe even Longhorn would have been a success, instead of having to wait for UWP with .NET Native.

Re:D Language accepted for inclusion in GCC by int_19h on Wednesday June 21, 2017 @08:43PM (#14609286)
Indeed. With C# especially it is rather ironic, because the timeline of its development closely overlaps with D - I remember learning the newly released C# 1.0 as I was experimenting with those early 0.x versions of D.
Re:D Language accepted for inclusion in GCC by throwaway7645 on Wednesday June 21, 2017 @07:08PM (#14608777)
I agree with your points. I do like to bring Nim up as it uses python like syntax with types and then transpiles to C. You get a fast and small native binary and can choose from 2 different GC or no GC. It has a small, but very active community.