8 ms·
D at 20: Hits and Misses [pdf]
- CamperBob2 7y agoI use binary literals all the time, for what it's worth, in code involving hardware interfacing. Only complaint with C++14's implementation is that they didn't allow underscores to be inserted for clarity, a la Verilog. Those underscores turn out to be a really big deal, and leaving them out of C++ was a massive mistake. Nobody wants to read constants like 00110100101101011011011101011110, but 00110100_10110101_10110111_01011110 is fine. An implementation of binary constants that doesn't allow this is going to be less popular.
- alexhutcheson 7y agoYou can use ' as the digit separator, like: 0b00110100'10110101'10110111'01011110 It's not ideal, but using underscores was off the table, because things like _100_ are actually valid variable names and it would have caused parsing issues.
- CamperBob2 7y agoThat's cool, I didn't know they supported that. Good enough! Of course, it's not as if '0' wouldn't be ambiguous, so I don't really buy the underscore-as-variable-name argument. C++ left context-free grammar behind a long time ago...
- WalterBright 7y ago_100_ is an identifier in D, too. The simple rule is _ can be embedded in a numeric literal, it just cannot start one.
- alexhutcheson 7y agoActually I got this wrong - the ambiguity occurs with C++11 user-defined literals, not with variable names. See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2747.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n274...
- wyldfire 7y agoWould you use a binary literal for a single bit set in a mask? I'd think a `1 << n` would be clearer in that case.
- exmadscientist 7y agoMy favorite use for them is when you've got to set a multi-bit field in a mask or register. If the hardware says bits 25-23 have to be 110 and bits 13-10 have to be 0101, reg = (0b110 << 23) || (0b0101 << 10); is by far the clearest way I know to write that. And since hardware descriptions usually (but not always) give descriptions in binary rather than decimal, it's the easiest form to check against the datasheet or manual.
- lesbaker 7y agoLooks like this is slides from a talk Walter Bright gave which has been posted to YouTube [1]. It helps with some missing context. For example, I wondered why in the slides he felt implementing contract programming in D was a miss; it seemed like a strong selling point for the language. According to the talk (around 1:34:30), however, he felt that contract programming was relatively unpopular/unused in D and that "assert" covered most of the use cases for it. [1] https://www.youtube.com/watch?v=p22MM1wc7xQ https://www.youtube.com/watch?v=p22MM1wc7xQ
- mamcx 7y agoContracts are interesting but I think to make it usefull 1) are ON on release! and 2) Become part of the docs. One example: fun date(y:i32, m:i32, d:i32) {... code ...} This scream for more context (and better param names!). With contracts: fun date(y:i32, m:i32, d:i32) assert y in 0..9999 m in 1..12 d in 1..31 {... code ...} But I need to see it in the docs, in the tooltips, etc. Now are useful!
- klipt 7y agoGood old February 31.
- mamcx 7y agoNothing like a bug behind a safety feature :)
- elgenie 7y agoThat’s … not a bug. A buggy assertion would be one that fires when the input is correct. Assertions aren’t formal verifiers or replacements for a test suite.
- squarefoot 7y agoObligatory reference:) https://www.youtube.com/watch?v=sVyRkl5qNb8 https://www.youtube.com/watch?v=sVyRkl5qNb8
- voldacar 7y agoWill the "misses" be removed from D eventually?
- earenndil 7y agoMany of them have been already.
- WalterBright 7y agoA tree needs pruning now and then :-)
- petre 7y agoI hope that doesn't mean removing the GC in favour of borrow checking or manual memory management.
- WalterBright 7y agoThe GC, although often maligned, is highly useful and will stay.
- kjs3 7y agoD is 20? That's.......telling.
- WalterBright 7y agoYes. We are persistent.
- tastyminerals 7y agoThat is if we count the development of D1 which appeared in 1999. Later in 2007 D2 emerged with breaking changes. D1 was discontinued in 2011 and D2 became simply D. So, yes formally D is 20 years old but one could say that it's newer reworked version is just 12.
- WalterBright 7y agoI started on D 20 years ago. It was a couple years before I even managed to make a prototype that people could play with. 20 years ago it was a few notes on a piece of paper :-)
- sedatk 7y agoI think the presentation exposes the big picture: D is a very loaded language. It tries to serve every possible exotic need imaginable. Probably not as much as C++ but that’s a committe-designed language, it doesn’t count. The feature bloat makes it very hard to learn D, let alone being an expert on it. I think it’s telling why its creator focuses on individual features to assess its success. Now, all those missed features either have to be maintained or carefully removed which is a lot of work and might actually break existing code. I like D because of its vision: C++ for humans. It fails on that vision simply because it has become a gigantic incoherent product like a research project. It probably needed a harsher approach to feature requests to make sure the language stayed on the vision. Now it’s a programmer’s dream and a programmer’s nightmare at the same time. I think Go, for instance, has made a better decision to stay barebones. I see that the creator intends to include Rust’s borrow-checking semantics which reminds me that Rust is probably what D should have been in all aspects.
- WalterBright 7y ago> The feature bloat makes it very hard to learn D Not at all. For example, if you know C-style programming, you can be productive in D with a pretty trivial investment in time. > Rust is probably what D should have been in all aspects While D will likely get some sort of borrow checking, it will not adopt the look and feel of Rust.
- harry8 7y agoPlease define "productive", doing what, to what end, with whom, at what level of complexity? Your clear thoughts here will be illuminating and worthwhile.
- WalterBright 7y agoProductive means simply that you're getting useful work done at an acceptable cost to you.
- harry8 7y ago
- Thorrez 7y agoInteresting that garbage collection is listed as a miss due to latency, and Go has gotten popular with garbage collection with an emphasis on low latency.
- pjmlp 7y agoThe big issue is lack of technical resources to improve GC's performance on D's runtime. Some improvements have been made lately, but not at the level of manpower and CS background from other GC enabled languages. I am quite confident that if D had something like Microsoft behind it, its GC would long be as good as Sing# or System C# (M#) were.
- WalterBright 7y ago> The big issue is lack of technical resources to improve GC's performance on D's runtime. The underlying issue is that to make the GC more performant requires the addition of "write gates", where writing through a pointer notifies the GC that the memory object has changed. This is a reasonable choice when a language is heavily GC dependent (like Java). However, D is not at all heavily GC dependent. But it is very dependent on memory references. Hence the GC speedup from adding write gates would be more than lost from the cost of executing those write gates.
- earenndil 7y agoGo's GC makes certain compromises that affect the language as a whole; this is not reasonable for d, which is frequently used without GC. The situation could definitely be improved by a lot; d's GC is just plain bad right now. But looking at other languages' GCs may give a misleading impression because those GCs' designs are not suitable for d.
- faissaloo 7y agoI guess they never miss huh
- renox 7y agoSome of the slides are contradictory: miss lack of safety by default and miss focus on GC. Well if you want safety by default, then either you use a GC or you're a Rust/cyclone clone, I don't see a third way..
- WalterBright 7y agoThere is a third way. We're working on it.
- pjmlp 7y agoThe third way is not throwing out the baby with baby water. The path pursed in the past by Mesa/Cedar, Modula-3, Sing# or more recently System C#. Provide automatic memory management by default, while offering all the tooling stack and global allocation, with low level stuff and untracked references requiring explicitly unsafe code. For more modern approaches that combine those ideas with Cyclone ones, Chapel, Swift, Ada/SPARK, ongoing Haskell and OCaml support for linear types. So you get the productivity of automatically memory management, graphs, self referencial structures and what not, while being able to go low level for more fine-grained resource management.
- fithisux 7y agoWhat I find D interesting is that it is a really good fit for scientific programming. Maybe Julia is an answer, but in terms of producing interoperable code, it is the holly Grail. And people can port their Java code mostly painlessly. Science is the killer app of D where GC is a blessing in disguise.