News for hackers. Stuff that matters.
Re:How I Came to Write D (2014) by WalterBright on Sunday June 03, 2018 @04:07PM (#17221492)
Logged in today and saw this! Walter here, AMA!
Re:How I Came to Write D (2014) by mpweiher on Sunday June 03, 2018 @05:21PM (#17222197)
Hi!

I dimly remember a fairly deep analysis/comparison of C++ and D that went into how opaque or transparent abstractions were to the compiler, and what that means for performance (models) and compile times.

I thought it was by you, but can no longer find it. Might you be able to point me at it?

Re:How I Came to Write D (2014) by WalterBright on Sunday June 03, 2018 @05:24PM (#17222233)
I don't recall writing such an article. It sounds intriguing, if you do find it, I'd like to see it.
Re:How I Came to Write D (2014) by mpweiher on Sunday June 03, 2018 @05:57PM (#17222495)
Sorry! I’ll keep looking.
Re:How I Came to Write D (2014) by ptrott2017 on Monday June 04, 2018 @05:56AM (#17226186)
Might possibly be Andrei Alexandrescu's The Case for D -also in Dr.Dobbs.

See here: http://www.drdobbs.com/parallel/the-case-for-d/217801225?pgn...

Re:How I Came to Write D (2014) by m12k on Monday June 04, 2018 @03:20PM (#17231189)
What is your opinion of Rust? It seems D and Rust can both be seen as saner successors to C++, so I imagine they attract a similar crowd, and maybe compete for mindshare. Any ideas from Rust you wish you'd incorporated in D? Any ideas you think Rust ought to borrow from D?
Re:How I Came to Write D (2014) by nspattak on Monday June 04, 2018 @04:23AM (#17225635)
I have been intrigued to learn D for a long time now but I never had the time to tinker with it before learning other languages that are more widely used.

Are there any reasons - in your opinion - which should make one start tinkering with D before spending time with rust or go ?

Re:How I Came to Write D (2014) by keldaris on Sunday June 03, 2018 @04:52PM (#17221895)
What's the plan for Phobos (and more generally the ecosystem) to be usable from the betterC subset of the language? In your opinion, how much of the development focus is aimed in that direction? Are there any parts of the language itself that will be made available to betterC that currently aren't?
Re:How I Came to Write D (2014) by WalterBright on Sunday June 03, 2018 @04:55PM (#17221932)
Most of the effort for BetterC has come from myself. Based on the buzz about it, it's usage is steadily expanding in the D community.

The idea of BetterC is to not link to the D runtime library at all.

So, the parts of Phobos that are usable from it are the parts that:

1. are "header only", meaning all the functions are templates

2. don't use exceptions or the GC

3. don't use OOP classes (which rely on the GC and the runtime)

Not much of effort has been expended cataloging this, though.

Re:How I Came to Write D (2014) by keldaris on Sunday June 03, 2018 @05:20PM (#17222190)
This begs two questions, it seems to me:

1. Would it make sense to work on (for the community in general, not necessarily you personally) a header only standard library, a sane STL if you will, for betterC?

2. Is there any interest in language support for GC and runtime independent classes/interfaces? I understand this is partly doable already by abusing templates, but I imagine the results aren't necessarily pretty or concise.

Regardless, thanks a lot for the responses. I haven't managed to write much D beyond small experiments due to ecosystem and related issues, but the ability to incrementally integrate small parts of D in a C++ codebase as freely as betterC lets me is very tempting.

Re:How I Came to Write D (2014) by WalterBright on Sunday June 03, 2018 @05:28PM (#17222284)
> Would it make sense to work on (for the community in general, not necessarily you personally) a header only standard library, a sane STL if you will, for betterC?

It's a very good question. Most of Phobos is already templates or the GC, so that wouldn't be much change. A more complex problem is working without exceptions. I don't have a ready answer for that, it's a good area for investigation.

D already has support for "COM" classes/interfaces which work in BetterC.

Re:How I Came to Write D (2014) by acehreli on Sunday June 03, 2018 @10:36PM (#17224113)
Weka has recently open-sourced their no-GC library Mecca: https://github.com/weka-io/mecca

Here is Shachar Shemesh's introduction:

https://www.youtube.com/watch?v=xNWRgEHxOhc&feature=youtu.be...

Re:How I Came to Write D (2014) by giancarlostoro on Sunday June 03, 2018 @06:25PM (#17222685)
> 3. don't use OOP classes (which rely on the GC and the runtime)

I was not aware of this at all, do you ever see a time where you could compile D with classes an all with no garbage collection? I am not bothered by the GC coming from C# and Python but it is interesting to know where D is headed since I know there were many efforts at making D compile without any GC.

Basically do you think it will ever make sense for D to just compile without GC by passing a compiler flag? Irrelevant of what D features are used, and maybe it can tell you which features cannot be used without GC (sorry if this already is a feature, I use D I'm not a guru yet).

Re:How I Came to Write D (2014) by WalterBright on Sunday June 03, 2018 @06:48PM (#17222845)
The compiler flag would be -betterC. You can use classes with no GC if you're willing to allocate and initialize them manually.
Re:How I Came to Write D (2014) by klez on Sunday June 03, 2018 @04:32PM (#17221685)
Hey, thanks for the opportunity :)

Suppose I was writing systems software. Considering I know neither, why would I invest time learning D instead of C++? Does D offer anything in that regard?

Re:How I Came to Write D (2014) by WalterBright on Sunday June 03, 2018 @04:43PM (#17221804)
D has checkable memory safety. In C++, memory safe code relies on following best practices.
Re:How I Came to Write D (2014) by jcelerier on Monday June 04, 2018 @03:35AM (#17225409)
-fsanitize=address in C++ is pretty much checked memory safety.
Re:How I Came to Write D (2014) by wyldfire on Monday June 04, 2018 @12:53PM (#17229742)
This is not the case. Not sure what guarantees D's checked memory provides but ASan doesn't offer protection from uninitialized reads. MSan, does, though.

Plus: none of the sanitizers offer quite-the-same runtime protections. They're intended for use in testing to flush out bugs, not production for avoiding bugs. As is, MSan and ASan are mutually exclusive.

Re:How I Came to Write D (2014) by atilaneves on Monday June 04, 2018 @07:11AM (#17226646)
_If_ your test coverage is good. I've seen it fail to catch a few bugs as well.
Re:How I Came to Write D (2014) by kqr on Monday June 04, 2018 @03:18PM (#17231164)
I think you two may be talking past each other, one speaking of "safety of checked memory access" and the other of "compile-time checking of memory safety".
Re:How I Came to Write D (2014) by pjmlp on Monday June 04, 2018 @04:22AM (#17225625)
In which page of ISO C++ it is described?

And on the C++ compilers that support such language extension, how does it work with binary dependencies?

Re:How I Came to Write D (2014) by jcelerier on Monday June 04, 2018 @09:10AM (#17227346)
> In which page of ISO C++ it is described?

why would it matter ? AFAIK D doesn't even have an ISO standard.

> And on the C++ compilers that support such language extension, how does it work with binary dependencies?

you at least get whole-program safety for libc calls since it works by replacing such calls through dynamic loading

Re:How I Came to Write D (2014) by pjmlp on Monday June 04, 2018 @09:27AM (#17227519)
> why would it matter ? AFAIK D doesn't even have an ISO standard.

Sure it does.

D is defined by the DMD compiler as the reference implementation.

Whatever DMD allows for minus implementation bugs, is what the D programming language means.

C++ is defined by an ISO standard, a document that specifies what every implementation is required to implement.

So any D developer can be sure their code is compliant as long as DMD accepts it, while a C++ developer needs to pay attention how close their favorite compiler is to ISO C++.

> you at least get whole-program safety for libc calls since it works by replacing such calls through dynamic loading

Libc is a very tiny portion of any industrial grade C++ application, and only relevant in open source systems, as it is shipped in binary form in other platforms.

Re:How I Came to Write D (2014) by repsilat on Monday June 04, 2018 @10:28AM (#17228039)
> any D developer can be sure their code is compliant as long as DMD accepts it, while a C++ developer needs to pay attention how close their favorite compiler is to ISO C++.

That's a cute, but if that's "the letter of the law" then Walter can replace DMD with emacs in the next release and it'd still be a conforming implementation, and you'd just have to rewrite your codebase in lisp to keep it functioning. All the options available to the D programmer in that case (like "keep using the previous version") are also open to C++ programmers when their compiler makes a change that breaks their code.

In practice everyone cares about stability. The C++ standard provides a signal that "this behaviour is (not) likely to change in the next release". All other features not mentioned in the standard like compiler flags and implementation details like the stack and the heap are on par with features in D when it comes to compatibility from version to version.

The C++ programmer who writes "to the implementation," not "to the standard" is in at least as stable and predictable a situation as the comparable D programmer.

Re:How I Came to Write D (2014) by coldtea on Monday June 04, 2018 @03:49PM (#17231578)
>That's a cute, but if that's "the letter of the law" then Walter can replace DMD with emacs in the next release and it'd still be a conforming implementation, and you'd just have to rewrite your codebase in lisp to keep it functioning.

Which is a contrived argument

Re:How I Came to Write D (2014) by repsilat on Monday June 04, 2018 @04:12PM (#17231878)
It is, and I said so too -- I was responding to some nonsensical lawyerism by showing that it was ridiculous on its own terms, and then I spent the rest of the post (the bulk of the post) talking about actual effective, pragmatic ramifications of having a language standard.
Re:How I Came to Write D (2014) by coldtea on Monday June 04, 2018 @06:02PM (#17233022)
Well, you don't need a standard that much if there's a single compiler, isn't that true?
Re:How I Came to Write D (2014) by repsilat on Monday June 04, 2018 @06:30PM (#17233229)
Sure, I agree with that. I think it's a coordination mechanism, and it tends to make language progress more conservative. I don't know if/when it's a net win, and I certainly wouldn't expect (or want) D or Python or Ruby to do it -- I think they do a better job of managing their own growth and development.

I do think it's a bit crazy to say that it can increase uncertainty about future compatibility, though -- on that front I think it standardisation has a strictly stabilising effect.

Re:How I Came to Write D (2014) by tmsldd on Monday June 04, 2018 @01:18AM (#17224873)
“I've never been comfortable programming in a language I hadn't written a compiler for “

That says everything. Thanks for this ;)

Re:How I Came to Write D (2014) by codyguy on Monday June 04, 2018 @01:23PM (#17229992)
Welcome back Walter! Which is your favourite D compiler? Do you ever play around with other compilers too and compare the executables?
Re:How I Came to Write D (2014) by NonEUCitizen on Sunday June 03, 2018 @10:20PM (#17224039)
Are there plans to add a WASM backend?
Re:How I Came to Write D (2014) by WalterBright on Sunday June 03, 2018 @11:35PM (#17224387)
No, but anyone is free to contribute to one. It's Boost licensed, after all!
Re:How I Came to Write D (2014) by giancarlostoro on Monday June 04, 2018 @03:07AM (#17225280)
I have not yet looked but have any in the community tried?

In your expert opinion would it make more sense for a WASM backend to be part or the DUB build process or embedded into DMD itself?

I think Rust has some approaches that let you build as an addon to Cargo (the Rust equivalent to DUB) so maybe a similar path might make sense? I do know there are efforts to bake WebAssembly into Rusts compiler down the road though.

Re:How I Came to Write D (2014) by pjmlp on Monday June 04, 2018 @04:02AM (#17225529)
Re:How I Came to Write D (2014) by giancarlostoro on Monday June 04, 2018 @05:01AM (#17225831)
Thanks for the links, I only ever used DMD and GDC (when I had some odd issue with DMD on some distros) but never LDC definitely checking it out. I'm glad there's a Snap package for it, seems to be the cleaner approach to installing dev tools for me.