www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Re: GoingNative 2012 to be livestreamed tomorrow

reply bearophile <bearophileHUGS lycos.com> writes:
Andrei Alexandrescu:

 I'm announcing this here because inevitably D will be mentioned during 
 the panel with Bjarne Stroustrup, Herb Sutter, Hans Boehm, and myself.

And also because several of the design ideas of C++ programs are useful in D code too :-) --------------------------- About Bjarne Stroustrup's talk "C++11 Style": I have appreciated (slide 22, at about 26.22) the stress on SI units, to use the type system and the new C++11 feature to some avoid some bugs with zero run-time cost. D requires a less natural syntax for them. I have also appreciated the very simple but useful part about type rich programming, with typeful interfaces (http://en.wikipedia.org/wiki/Typeful_programming ). Another thing I've appreciated about Bjarne talk is that I'm able to understand it at about 1.3X speed (with just few pauses to digest certain slides). The example of Vector Vs List (slide 51) is too much artificial, but the answer (in the invisible graph) is interesting. Lists are kind of dead noways. The slide 64 "Low-level != Efficient": in D we'll write just: sum(v) Instead of the currently used: reduce!{a + b}(0, v) Because sum() is a very common need. Overall Bjarne Stroustrup's talk was very good, and I agree with everything he has said and with his choice of topics to talk about :-) --------------------------- About Stephan T. Lavavej's talk "STL11 - Magic && Secrets": The "Computers are fast" slide at 20.31 is nice, it shows vector.emplace_back for a pair. Seeing this talk at 1.4X is a bit tiring (I can't go past 1.6X because my video player is dumb, it's compressing audio in a uniform way, without taking into account the characteristics of human voice). Regarding slide 25 (51.54), in D I'd like to use "const" and "const ref" in foreach loops, just like "ref": struct S { int x; } void main() { S[] array = [S(1), S(2)]; foreach (ref s; array) {} // OK foreach (const ref s; array) {} // error foreach (const s; array) {} // error } Bye, bearophile
Feb 04 2012
parent Walter Bright <newshound2 digitalmars.com> writes:
On 2/4/2012 9:08 AM, bearophile wrote:
 About Bjarne Stroustrup's talk "C++11 Style":

 I have appreciated (slide 22, at about 26.22) the stress on SI units, to use
 the type system and the new C++11 feature to some avoid some bugs with zero
 run-time cost. D requires a less natural syntax for them.

C++ allows for user-defined literals, such as: 30sec The D equivalent would be: sec!30 The C++ version is a bit hackish in that it relies on sec being a global function. There's no opportunity for scoping, encapsulation, etc., and if two different libraries defined overloads for sec on int, you're just stuck. We'll see how this unfolds in practice. The D version does not have these issues (and is not even a special feature - it's just another way to use an existing feature).
Feb 04 2012