8 ms·
Walter here. AMA.
by WalterBright 9y ago
Walter here. AMA.
- thespirit 9y agoHas the re-write to D felt productive? May it have been better to start from scratch? Was the "D as a better C" approach inspired by your want to transition DMC to D?
- WalterBright 9y ago> Has the re-write to D felt productive? Yes, it's been oddly satisfying. > May it have been better to start from scratch? Ah, the age old question. I can guarantee, though, the answer is no. It took me maybe a couple weeks to convert the entire front end from C++ to D. Contrast that with the Warp preprocessor I wrote for Facebook, which took many months, and I knew what I was doing. And that is just the preprocessor! Basically, writing a C++ front end takes 10 man years. I know of no effort that took less time, and this is assuming the best in the business doing the writing. > Was the "D as a better C" approach inspired by your want to transition DMC to D? Partially, yes. And certainly doing the transition work has improved betterC. Nothing like proving it works than translating a crotchety old horrifyingly complex piece of code written in 1980's style. I plan on doing this to all my old projects that are still in use.
- loup-vaillant 9y ago> Basically, writing a C++ front end takes 10 man years. This is insane. No language needs to be that complex. I guess that's the power of backward compatibility: forcing an entire industry to dig itself into an ever growing hole, because in the short term we move faster by digging than by first clawing our way out.
- WalterBright 9y agoMastering C++ takes about 10 years, too :-) (Yes, you can be productive in C++ in much less time.)
- marcoperaza 9y agoI just want to thank you for all your work on this. DMC is the very first C compiler I ever used, back in the early/mid 2000s. It was my first real foray into programming, and I was running Windows XP. I remember liking that DMC was free and no-BS. Unlike some of the competition (at least as far as 11-year-old me understood), it didn’t want me to install a whole IDE or other craziness along with it. Good to see that the project is still going.
- WalterBright 9y agoThanks for the kind words! I'm auld skool in that I like command line tools, and DMC++ reflects that in not requiring an IDE. The actual compiler and libraries are pretty small. Back in the aulden days, it could also be run directly from the distribution CD without requiring an install. These days the "install" is merely unzipping the file.
- TallGuyShort 9y agoSame here! 11 year old me got Turbo C++ as a birthday gift. Once I learned the language, I was frustrated at how Microsoft and Borland and everyone tried to lock you into their ecosystem. MinGW was an option but Digital Mars was the bee's knees. A big stepping stone to my eventual career.
- WalterBright 9y agoNice! I didn't get any access to a computer till I was 16. I had to punch cards and hand them to the teacher who'd run them as batch jobs. In college all students had accounts on the college PDP-10, a marvelous machine for its day.
- greenhouse_gas 9y agoHow does it feel having your "life's work"[1] becoming big enough to be noticed, but ignored by the mainstream? You created the first "better C" out there to get any traction, it had a perfect name (B -> C -> D), but due to factors that were partially [2] outside your control [3], D's niche got eaten by Go and Rust. [1]. The D programming language. [2]. I've seen people blaming the D to D2.0 transition, but D was a niche language before too. I've also seen people blame D for not having an Open Source compiler for years, but neither did Java, and it took off anyways. [3]. Such as Sun's marketing, or the general push to scripting languages between 1995-2010 (such as perl, tcl, PHP, Ruby, Python and Node)
- WalterBright 9y agoWhen I started, I was well aware of: "Certainty of death. Small chance of success. What are we waiting for?" https://www.youtube.com/watch?v=8joT0oFuGoI https://www.youtube.com/watch?v=8joT0oFuGoI For a language without a megacorp pushing it, D is spectacularly successful. Consider: 1. It's developed by volunteers who work on it for the joy of it without remuneration. 2. People who spend the effort to get past the learning curve find it very pleasing and productive. 3. Other major languages have been continuously copying D's features :-) 4. Corporations that have adopted it for mission critical use have told me that D is their "secret weapon" that allows them to out-maneuver and out-innovate their competitors. It's like the music business - you don't have to be the Beatles to have a very good career.
- codyguy 9y ago> "Certainty of death. Small chance of success. What are we waiting for?" You are an inspiration Walter !!
- WalterBright 9y agoMy favorite line from the movie.
- thawkins 9y agoWalter, I have been using your products way back since before Zortech, at the time it was the only C++ system that I could get to work with the Phar Lap DOS extender to create big binaries. Thank you for all your hard work, your products formed the center on my early career, and most of what i know i learned using your tools. Note I particularly loved "Zed" the text editor that came with the early toolchain. Regards Tim Hawkins, a grateful hacker.
- gravypod 9y agoI'm a little confused. I've heard of Digital Mars around the internet but I don't know what it is or why the company was started. For my entire life as a Software Engineer the idea of a close sourced or proprietary compiler was just alien to me. What set you down the path of writing compilers? Did anyone buy licenses to your compilers? Why was D started? A more technical question: Was there any abstraction/pattern that has been deeply rooted into your code base that you are unable to change due to prevalence yet this pattern/abstraction makes it more difficult to maintain your code base? In any other words: have there been any mistakes made?
- WalterBright 9y agodigitalmars.com ! When I started, everything was closed source. Open source was inconceivable. I started writing compilers in order to speed up my game Empire (www.classicempire.com). Compilers turned out to be more interesting :-) Yes, many bought licenses. D was started because I got bored with retirement (6 weeks of watching TV will do that do you). My ideas for improving C++ met with enormous resistance. So I did my own language. Ironically, D features have steadily been adopted by C++. > have there been any mistakes made? Haha, I could spend months responding to that! Probably the worst abstraction in the DMC code base is the use of linked lists. They're slow, cache-unfriendly, and leaky. I learned my lesson with DMD, which uses adjustable arrays instead. I've tried encapsulating the lists, like CodeBuilder in the back end, but it's a LOT of work to get that in. It wouldn't have been so much work if the list abstraction didn't leak the structure of the list at every opportunity.
- krylon 9y ago> I started writing compilers in order to speed up my game Empire (www.classicempire.com). Compilers turned out to be more interesting :-) That seems to be a recurring pattern in the history of software. Unix was created for similar reasons (to create a self-hosted development environment for game), and the Linux kernel started out as a terminal emulator.
- glandium 9y ago> D was started because I got bored with retirement (6 weeks of watching TV will do that do you). Waw, you retired "young".
- girvo 9y agoYours was the compiler I used to learn C++ in 2003. Thank you!
- colomon 9y agoI learned C++ in 1989 using one of his earlier compilers!
- c-smile 9y agoI still have somewhere Walter's Zortech C++ that was life saver for me at one point. H/W: i386 machine 25 mhz, 2mb RAM. Internet: No OS: MSDOS IDE: MultiEditor + Zortech C++ Where: in the middle of nowhere - small town between Europe and Asia. At some point upgraded the whole setup to Symantec C++ on Windows - for unknown now reasons.
- rurban 9y agoFor me also Zortech was gold. The Symantec version was also fine. Loved the compiler and the UI. Best UI ever. Esp. if compared to the Turbo/Borland stuff and then MSVC.
- WalterBright 9y agoHaving nice users like you guys is very gratifying!
- codyguy 9y agoDear Walter, Thank you for the great work you are doing. If you could get people to include D in the benchmarks / shootouts that get published it would help improve the popularity of D. FYI - Thatneedle.com already uses it for part of the backend data processing workflow.
- WalterBright 9y agoIsaac Gouy is the gatekeeper for the shootout, and he refuses to include D for reasons he's refused to elucidate. I stopped publishing benchmarks myself 15 years ago as people always assumed my thumb was on the scale.
- codyguy 9y agoI was a bit surprised by the inclusion of lesser languages and the omission of D !! Please share the secret of your tenacity and inspiration in the face of such "setbacks". How do you do it on a day to day basis?
- WalterBright 9y agoI know how good D is and I have a lot of confidence in it. There are a lot of great people using it that are getting their jobs done faster & better and are thereby making more money. That's what matters to me. Everybody likes to make more money :-) Back when I was a brand new engineer at Boeing, I was talking to my lead engineer about the beauty of aerospace engineering. He smiled and said I didn't get it. Boeing wasn't making airplanes, they were building money making machines for airline companies. That the airplane turned out to be a beauty was just a happy side effect! D isn't about my personal aggrandizement. It's about how effective it is for users at solving their problems and making money for them.
- e12e 9y agoHas there been any recent discussion on this? I suspect earlier reasons might have included D not being packaged for Debian? It can be though to shake "early license impressions" - D (dmd specifically) is one example, Ada (FSF GNAT vs AdaCore's GNAT Pro and Ada-gnat - GPL w/o runtime exception) is another. [ed: if others are interested in "make your own measurements and host it yourself", relevant page with link to code etc appear to be: https://benchmarksgame-team.pages.debian.net/benchmarksgame/play.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... ]
- stochastic_monk 9y agoI haven’t yet tried D, but it’s on my list. It’s truly impressive to have a C/C++ contender which can actually compare in performance. It’s a less serious question to ask, but was the name in any way related to Run-DMC, the 80s hip hop group?
- krylon 9y agoI briefly dipped into D about two years ago. In terms of features, it is similarly big as C++, but a lot more sanity-oriented in terms syntax and semantics. The library ecosystem could be better, but IIRC, it is possible to use C (maybe even C++) libraries from D. The community is awesome, super friendly and super helpful even in the face of the most stupid newbie-questions I could come up with. ;-) In the end, I backed out, because the language was too big and complex for my taste and needs. But if you kind-of-like C++, you are likely to fall in love with D.
- WalterBright 9y agoD is indeed a fully equipped machine shop, but nobody says you have to start with the Bridgeport milling machine. You can write very capable programs with just the C-ish subset.
- krylon 9y agoI tried, I really did, but then I got distracted by all those shiny features and was unable to resist the temptation to play with them all. :-) I had the same problem with C++. I will probably give it another try one day, if only for the super-friendly and welcoming community.
- WalterBright 9y agoNo - the comparison never occurred to me.
- codyguy 9y agoI was just looking at your classicempire site and stumbled upon the rejection letters!! Did you take up Sirius's offer to act as broker for 30% cut on deal?
- WalterBright 9y agoNo. 30% is absurdly high.
- codyguy 9y agoCould you enlighten on how you managed to take those to market after the rejections?
- WalterBright 9y agoInterstel didn't reject it, and Interstel Empire made history!
- gok 9y agoAre you adding any features to the C/C++ compiler or just migrating to D?
- WalterBright 9y agoNever mix migrating with adding features. It's the path to the dahhk side!
- runawaycosine 9y agoThank you for the AMA. :) What is your opinion of Rust? It seems to me like Rust and D have the same target audience and both want to be the next C++.
- WalterBright 9y agoRust and D are very different languages. I suspect the choice between the two is more a matter of personal taste. D, for example, achieves memory safety in a very different way than D's borrow checker.
- le-mark 9y agoIs the exception handling DMC C++ implements zero cost or setjmp/longjmp based?
- MaxBarraclough 9y agoI'm pretty clueless here, but from a quick search on GitHub it looks like there's support for NT exception handling, and DWARF exception handling. (I realise this doesn't really answer your question, but it's a start.) https://github.com/DigitalMars/Compiler/blob/7a33233c/dm/src/dmc/nteh.c#L302 https://github.com/DigitalMars/Compiler/blob/7a33233c/dm/src... https://github.com/DigitalMars/Compiler/blob/7a33233c/dm/src/dmc/dwarfeh.c#L4 https://github.com/DigitalMars/Compiler/blob/7a33233c/dm/src...
- WalterBright 9y agoC++ EH is never zero cost, despite the hype. Herb Sutter just wrote a proposal to redo the semantics in C++ to reduce the cost of it. DMC++'s EH is not setjmp/longjmp, it is Windows SEH (Structured Exception Handling) based. The 32 bit DOS extender EH is based on my own table-based design.
- ximeng 9y agoWhat's the business model / long term plan for sustaining development on the compiler / D?
- exikyut 9y agoNot OP, but https://digitalmars.com/consulting.html https://digitalmars.com/consulting.html has sat around for a while. I get the (un-citeable) impression it has a few takers (simply by virtue of the fact that the link exists, more or less).
- ximeng 9y agoThere is also https://dlang.org/foundation/about.html https://dlang.org/foundation/about.html which has links to a donations page which has around 3k USD a year of income.
- mhd 9y agoDid the rewrite give you any interesting perspectives on how to structure BetterC differently to both C and D?
- WalterBright 9y agoMore like it just made clear some shortcomings that needed to be fixed.
- MaxBarraclough 9y agoHi Walter, great work as always. I'm a fan of D as a language, but how do you respond to the question of "We should just go with C# or C++, why go with a middle-ground language like D that few programmers know?" Given that D --> C++ migrations have happened in the past, this strikes me as D's big challenge: finding its place. I'm thinking in particular of OpenMW: https://forum.openmw.org/viewtopic.php?t=2189 https://forum.openmw.org/viewtopic.php?t=2189
- WalterBright 9y agoI ask them how much money they've lost on C/C++ buffer overflows in the past, and how much they're willing to lose on them in the future :-) Heartbleed. A C buffer overflow bug so disastrously expensive it has it's own logo! (I know C# doesn't have buffer overflows either, but C# is a much bigger change than going to D, and is less portable.)
- earenndil 9y agoTBF, c++ has std::vector and std::list.
- renox 9y agoAnd with the "usual" access '[]' std::vector doesn't bound check either, you have to use 'at' for this (except in some library with some flags ), doesn't seem that safe to me!
- MaxBarraclough 9y agoAgree. It strikes me as silly that C++ doesn't provide something like a `CHECKED` macro, so that operator[] could always be range-checked in debug/dev builds, but not in release builds. The two-different-methods approach seems awfully clunky - what ends up happening is that no-one uses the `at` method. I see no good reason not to enable range-checks by default in debug builds. This 'unsafe by default' philosophy isn't universal in C++ though. The smart-pointer class-templates are always thread-safe, despite the possible performance consequences.
- exikyut 9y agoHopefully you see this This is a question I'm sure many have: how feasible would it be to get DMC++ emitting Linux code? D uses the same backend, in theory, but I'm not sure how much divergence there is between the D backend and this code. Perhaps you could get Hello World to build, make a gigantic list of everything that's broken, and see how much traction (hopefully) appears out of thin air :) I love tcc for its "oh it already finished" compilation time (300ms :D), even (and especially) on older hardware. I wish there was something out there to compare it with; it's quite unfortunate it sits on its own, because it hasn't had an official release in in 4 or so years.
- WalterBright 9y agoYou're right, the pieces are in place to do it. I've just never taken that last step.
- exikyut 9y agoOh, all right!! Cool! I'll definitely be keeping a slightly closer eye on DMC++ now and watching it for changes then, I think :) I've wanted to play with C++ for quite some time, but (as crazy as it might sound) gcc/clang's multi-second compile times for the smallest of things (eg, messing around with FLTK, which doesn't go that crazy with C++ features) makes tinkering a bit distracting. Multiple seconds for medium+ things, maybe, but tcc has spoilt me when it comes to rapid iteration, heh. A C++ compiler for Linux with speed reminiscent of (or maybe even similar to!) tcc would have a very big (if quiet) impact for a few people, I reckon. Something nice to have one day. (Unrelated, but fiddling around to get `dmd -c' + external libphobos.so + ld.lld makes for especially nice compilation speed :) ) Is there any specific reason the last step you speak of hasn't been taken? Just time/inertia, or reluctance for technical reasons? I think many people would be interested to hear what effort you'd want to fold into a Linux release, if there are any technical issues.