Re: What does C++ do better than D? - StackOverflow.com
Caligo: > FWIW, there is now http://codegolf.stackexchange.com/ A first solution to: http://codegolf.stackexchange.com/questions/3258/multiples-of-67-in-a-constructed-array-of-arrays 174 chars: import std.stdio,std.range,std.array,std.algorithm; void main(){auto A=array(map!"a+0L"(iota(1,100,2))),t=1;while(A.length)t+=count!"!(a%67)"(A=A[0..$-1]+=A[1..$]);write(t);} Because of a Phobos bug I have had to write: array(map!"a+0L"(iota(1,100,2))) Instead of: array(iota(1L,100,2)) A way to write unittests: create a 2D table (even on paper, if necessary), or nD tensor, of all the possible combinations of things usable by your code, even useless or absurd or outlandish ones, and then write 2 or 3 different tests for each one of those squares in your table, systematically. Bye, bearophile
Re: What does C++ do better than D? - StackOverflow.com
FWIW, there is now http://codegolf.stackexchange.com/ There aren't that many D solutions, but the ones I've found are better than the C++ ones in many ways. It's just a good place to compare and contrast programming languages solving the same problems.
Re: What does C++ do better than D? - StackOverflow.com
> Jonathan M Davis Wrote: > > There's a difference between a programming language which has reached an > > appropriate level of maturity that people can use it without fear of > > running into compiler bugs or issues with the spec and a language which > > is frozen. > > Maybe, they just enjoy running into mature language design bugs? > > > No, D will likely never be frozen. It will continue to evolve. > > So do C, C++, C#, Python... some motions in java domain... Even HTML does > it. I wasn't saying that they don't. They do (though C and C++ are notoriously slow about evolving). My point is that most programmers don't really expect a compiler to have bugs. Yes, like every other piece of software, even mature compilers have bugs, but with mature compilers, people generally either don't run into them or don't notice them (especially if they're subtle bugs). So, your average programmer is _not_ going to be happy with a compiler like dmd where you can run into bugs quite easily. And there is a very big difference between having a compiler which is constantly improving but which still has bugs which are easy to run into and a compiler which is constantly improving but where you rarely hit bugs in it when using it. C, C++. C#, Python, etc. are all mature enough that bugs in their compilers and standard libraries are going to be comparatively rare for most programmers. D is not at that point yet. _That_ is the point that we need to reach to really consider D to be a "finished product." It's getting there, and it will continue to evolve even once it's reached that point, but until it does reach that point, D will be a unacceptable to many programmers simply due to the quality of implementation issues. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
Jonathan M Davis Wrote: > There's a difference between a programming language which has reached an > appropriate level of maturity that people can use it without fear of running > into compiler bugs or issues with the spec and a language which is frozen. Maybe, they just enjoy running into mature language design bugs? > No, D will likely never be frozen. It will continue to evolve. So do C, C++, C#, Python... some motions in java domain... Even HTML does it.
Re: What does C++ do better than D? - StackOverflow.com
On Wednesday 03 August 2011 04:52:51 Kagamin wrote: > Don Wrote: > > Completely agree. Right now, we don't *want* to attract anybody who > > expects a finished product. We shouldn't advertise as if we do. > > Well, there's not such thing as a finished product. Things either rock or > suck. If something doesn't work, it sucks, but that's manageable with > advertisement: Americans think what you say them to think. They can't even > use tabs for code formatting. There's a difference between a programming language which has reached an appropriate level of maturity that people can use it without fear of running into compiler bugs or issues with the spec and a language which is frozen. No, D will likely never be frozen. It will continue to evolve. We may very well end up making D3 at some point. But until dmd and Phobos are at the point that it's unlikely that you're going to run into bugs in them (like you'd expect with C++, Java, python, etc.), then D isn't really mature enough for mainstream use, and a lot of people who try it out will get turned off by it. We're approaching the point where we'll have that kind of stability, but we're not there yet. And it's important that we recognize that fact. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
Don Wrote: > Completely agree. Right now, we don't *want* to attract anybody who > expects a finished product. We shouldn't advertise as if we do. Well, there's not such thing as a finished product. Things either rock or suck. If something doesn't work, it sucks, but that's manageable with advertisement: Americans think what you say them to think. They can't even use tabs for code formatting.
Re: What does C++ do better than D? - StackOverflow.com
bearophile wrote: Peter Alexander: It's interesting that you've brought up the issue of the message being sent out about D, because I feel it is exactly the opposite: it's far too positive. Everyone seems to only talk about all the cool features in D and seem to ignore all the issues that exist. ... It's hard to quantify whether my post has had a negative or positive impact on the language, but I believe honesty and openness are good things. People coming anew to D shouldn't be misled into thinking that it has no issues (as I was -- no one mentioned the implementation issues). I believe a disappointed user is much worse than missed user. I agree. Andrei (and others) were not listing the bad sides enough. A bit more transparency is better even in discussions outside this newsgroup. It's dangerous to give false hopes. Bye, bearophile Completely agree. Right now, we don't *want* to attract anybody who expects a finished product. We shouldn't advertise as if we do.
Re: What does C++ do better than D? - StackOverflow.com
Peter Alexander: > It's interesting that you've brought up the issue of the message being > sent out about D, because I feel it is exactly the opposite: it's far > too positive. Everyone seems to only talk about all the cool features in > D and seem to ignore all the issues that exist. > ... > It's hard to quantify whether my post has had a negative or positive > impact on the language, but I believe honesty and openness are good > things. People coming anew to D shouldn't be misled into thinking that > it has no issues (as I was -- no one mentioned the implementation > issues). I believe a disappointed user is much worse than missed user. I agree. Andrei (and others) were not listing the bad sides enough. A bit more transparency is better even in discussions outside this newsgroup. It's dangerous to give false hopes. Bye, bearophile
Re: What does C++ do better than D? - StackOverflow.com
On 2/08/11 2:29 AM, Andrei Alexandrescu wrote: Overall I feel Peter's post on stackexchange did more bad than good (of course that doesn't mean he had the right; I'm just writing this under the hypothesis he meant well and he'd be interested ). Within the confines of the community, discussing such issues is welcome and healthy. Mentioning these to the outside blows the issues out of proportion and conveys the wrong message to someone coming anew to D. It's interesting that you've brought up the issue of the message being sent out about D, because I feel it is exactly the opposite: it's far too positive. Everyone seems to only talk about all the cool features in D and seem to ignore all the issues that exist. I first came to D precisely because I had heard about all the cool features: the nice template syntax, uniform function call syntax (what's happening with that btw?), CTFE etc. Of course, as soon as I tried to use those features I found out that they existed only in the specification, not in the implementations. I quit using D shortly afterwards out of frustration that the language wasn't what was advertised to me. I only came back after seeing Tomasz' work (which turned out to be in D1, but it sparked my interest again). It's hard to quantify whether my post has had a negative or positive impact on the language, but I believe honesty and openness are good things. People coming anew to D shouldn't be misled into thinking that it has no issues (as I was -- no one mentioned the implementation issues). I believe a disappointed user is much worse than missed user. Plus, C++'s type system is marred by issues, so the statement has correctness issues to start with. Const is a mix of storage type and type qualifier; even most experts have no idea about that, and the minority of experts who do know about the distinction have difficulty figuring which is in effect when. Type deduction with functions and const is essentially a collection of special cases. Pointer to member functions have a type, but it can't be named, spelled, or used. Functions taking char* still accept string literals (compilers increasingly override that, but the rule is in the standard for C's sake). There is no way to convert a void* to a pointer to function, meaning all dynamic loading facilities must operate outside the standard. There is no way to specify or figure out alignment. Slicing polymorphic objects is legit. And so on and so forth. Now this is very interesting and a perfect example of the point I'm trying to make about implementations being more important than specifications. You say there is no way to convert a void* to a function pointer inside the standard. Who cares? It works in the implementations. You say there's no way to specify or figure out alignment? Yes there is: compiler extensions. Wrap them in a macro and you're good to go. These problems with C++ that you've listed are imaginary problems that only exist in theory. In real world C++ they are solved problems. Do you know what will happen once (for example) alignment is standardised? Nothing. People will keep their compiler specific macros because they'll probably need to support pre-C++0x implementations. Maybe they'll add some extra macro conditions to support C++0x compilers and in 10 years time maybe they'll drop support for old compilers. It's funny that you argue that a bad language design last forever while a bad implementation is transitory. From what I can see, it appears to be the other way round. Just look at the Boost library. It still has code to handle compilers without partial specialisation support, and code to work around various other implementation specific behaviour. C++ (the language) is changing, but those bad implementations are still in use. How many websites still need to support IE6? I hope this illuminates the point I am trying to make.
Re: What does C++ do better than D? - StackOverflow.com
On 8/2/2011 3:00 PM, Marco Leise wrote: Hmm yes, that cannot be argued. But you can go with the undefined behaviour resulting in casting away const in D. Isn't that the same category? Not exactly: 1. Undefined behavior is just that, undefined. In C++, it is defined behavior and must be supported. 2. In safe mode in D, you cannot cast away const.
Re: What does C++ do better than D? - StackOverflow.com
Am 02.08.2011, 21:46 Uhr, schrieb Walter Bright : On 8/2/2011 3:18 AM, Marco Leise wrote: On this higher level C++ gives the form of logical protection for the 'caching' case that I need as an OO programmer. My point is C++ simply does not give that protection. The protection is there only by *convention*. It is not a language feature. Hmm yes, that cannot be argued. But you can go with the undefined behaviour resulting in casting away const in D. Isn't that the same category? And do you sometimes think "Hey you guys can just use C++ or Java if you think D is wrong!" ? I hope not. I enjoy looking into an evolving language and discuss it and I've written a DOS animated GIF viewer and an MD5 hasher in assembly. So I like being close to the silicon from time to time when I'm not trying to hail the OOP gods.
Re: What does C++ do better than D? - StackOverflow.com
On 8/2/2011 3:18 AM, Marco Leise wrote: On this higher level C++ gives the form of logical protection for the 'caching' case that I need as an OO programmer. My point is C++ simply does not give that protection. The protection is there only by *convention*. It is not a language feature.
Re: What does C++ do better than D? - StackOverflow.com
Andrei Alexandrescu Wrote: > Mentioning these to the outside blows the issues out of > proportion and conveys the wrong message to someone coming anew to D. Well, from my point of view the very question "Is there anything C++ does better than D" implies C++'s inferiority and the answers become a pointless nerd talk about how to write a cross-platform code in assembler or how to extend metadata in standard C++.
Re: What does C++ do better than D? - StackOverflow.com
On 8/2/11 8:59 AM, Jeff Nowakowski wrote: On 08/01/2011 09:29 PM, Andrei Alexandrescu wrote: I know how to fix the design (in fact the implementation, the design is sound). It's just ever so difficult to find the time to prioritize for it. This sounds familiar to "I have discovered a truly remarkable proof which this margin is too small to contain." I wish anything about immutability was nearly as remarkable as Fermat's last theorem :o). Andrei
Re: What does C++ do better than D? - StackOverflow.com
== Quote from so (s...@so.so)'s article > On Tue, 02 Aug 2011 14:17:29 +0300, person wrote: > > The problem as I see it is that D has two separate concepts that are > > conflated: > > const and immutable. In fact, I'd argue that immutable shouldn't even > > exist in its > > current standalone state but should rather be part of an ownership > > system a-la > > Bartosz' suggested annotation system. > The way const and immutable work in D is something essential, one is > mostly useless without the other. > I think people have a few misconceptions regarding how they work. > fun1(const Bar b1); // you can pass both mutable and immutable, but after > you enter here it treats "b1" just like fun2 treats its argument "b2". > fun2(immutable Bar b2); // you can pass only immutable I know how const/immutable currently works in D. I was suggesting it has problems. > > In the context of single threaded programs const mustn't be transitive. > > E.g. > > class Foo { int a; ... } > > class Bar { Foo foo; ...} > > void func(const Bar b); > > void gunc(immutable Bar b); > > > > func should be able to change b.foo.a but not b.foo (foo is head-const > > or "final") > > gunc however will enforce transitivity and will not allow to change > > b.foo.a > Wouldn't that be just going right back to C++ const system, (well i think > it is also what you want)? > Also the main purpose of const in D is providing a immutable environment > for both mutable and immutable types. I'm not suggesting going back to C++ (which sucks). I'm suggesting that handling an immutable environment in D should be different. > > In the context of multi-threaded programs, casting const(T) to an > > immutable(T) > > would require locking/synchronization in order to preserve correctness. > > > > To conclude, Instead of D's current model where both T and immutable(T) > > can be > > "up-casted" to const(T) I'm suggesting > > T -> const(T) -(locked)-> immutable(T) > > > > In addition, compile-time "manifest" consts via enum should be removed > > in favor of > > immutable. > AFAIR that wasn't possible, enum states it is a compile time constant > unlike immutable. > I think we should drop const in our discussions when we mean immutable. > Its use in C++ is too broad and sometimes not applicable in D. enum is a *hack* required only to circumvent the current linker. There is nothing in the language design that requires this. The /correct/ solution would be to use immutable and let the tool-chain figure out that memory is only required if you take the address of that immutable.
Re: What does C++ do better than D? - StackOverflow.com
On Tue, 02 Aug 2011 14:17:29 +0300, person wrote: The problem as I see it is that D has two separate concepts that are conflated: const and immutable. In fact, I'd argue that immutable shouldn't even exist in its current standalone state but should rather be part of an ownership system a-la Bartosz' suggested annotation system. The way const and immutable work in D is something essential, one is mostly useless without the other. I think people have a few misconceptions regarding how they work. fun1(const Bar b1); // you can pass both mutable and immutable, but after you enter here it treats "b1" just like fun2 treats its argument "b2". fun2(immutable Bar b2); // you can pass only immutable In the context of single threaded programs const mustn't be transitive. E.g. class Foo { int a; ... } class Bar { Foo foo; ...} void func(const Bar b); void gunc(immutable Bar b); func should be able to change b.foo.a but not b.foo (foo is head-const or "final") gunc however will enforce transitivity and will not allow to change b.foo.a Wouldn't that be just going right back to C++ const system, (well i think it is also what you want)? Also the main purpose of const in D is providing a immutable environment for both mutable and immutable types. In the context of multi-threaded programs, casting const(T) to an immutable(T) would require locking/synchronization in order to preserve correctness. To conclude, Instead of D's current model where both T and immutable(T) can be "up-casted" to const(T) I'm suggesting T -> const(T) -(locked)-> immutable(T) In addition, compile-time "manifest" consts via enum should be removed in favor of immutable. AFAIR that wasn't possible, enum states it is a compile time constant unlike immutable. I think we should drop const in our discussions when we mean immutable. Its use in C++ is too broad and sometimes not applicable in D.
Re: What does C++ do better than D? - StackOverflow.com
On 08/01/2011 09:29 PM, Andrei Alexandrescu wrote: I know how to fix the design (in fact the implementation, the design is sound). It's just ever so difficult to find the time to prioritize for it. This sounds familiar to "I have discovered a truly remarkable proof which this margin is too small to contain."
Re: What does C++ do better than D? - StackOverflow.com
On 08/02/2011 07:26 AM, Peter Alexander wrote: Here's the thing: Unless you're developing a D compiler, there's no difference between a QoI issue and a language design issue. An issue is an issue, whether the fix is to change the design or to change the compiler. In my opinion, there's very little point in discussing a language's merit without discussing the tools. A design without an implementation has no worth. As Steve Yegge likes to say, a language's popularity is all about the tools. Fair point. It's just good to to use the right terminology. Otherwise if you say "bad design" that's forever. "Insufficient implementation" is transitory. What's more constructive? Judging a language based on the Digital Mars Hypothetical Future D compiler, or based on DMD, GDC and LDC? What's the point of saying that a language has no flaws, but there are no implementations of that language? Probably the worse mistake is saying that the language has a flaw because its implementation has one. Andrei
Re: What does C++ do better than D? - StackOverflow.com
Peter Alexander: > What's the point of saying that a language has no flaws, but there > are no implementations of that language? The task of inventing a flawless language is much more difficult than actually implementing it (but the latter may take more time), so I think there is a point. -Timon
Re: What does C++ do better than D? - StackOverflow.com
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > On 8/1/11 7:56 PM, Brad Roberts wrote: > > On Mon, 1 Aug 2011, Peter Alexander wrote: > > > >> On 1/08/11 7:29 PM, Kagamin wrote: > >>> Walter Bright Wrote: > >>> > Now on reddit! > > http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_t han_d/ > >>> > >>> C++ has a better thought out type system. > >>> Nice joke. > >>> http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html > >> > >> Please read my note at the end. I believe D (probably) has a better type > >> system. It just wasn't very well though out. > >> > >> I believe many aspects of D's type system were added in without fully > >> exploring the ramifications they had on other parts of the language. There are > >> at least two pieces of evidence which support my belief: > >> > >> 1. The fact that you can't copy const struct objects containing reference > >> types. > >> > >> 2. The fact that the root object still isn't const correct. > >> > >> > >> C++ has some questionable choices for its type system, but it generally > >> doesn't prevent you from getting work done. > > > > You're mixing state of implementation with design of the type system. > > Easy enough to conflate, but still a conflation of issues. > > > > Don't get me wrong, that there's QOI issues still is a real problem. I'd > > also agree that it's in the top 10 list of real problems. I don't know > > that I'd make it #1 on the list, though. Please don't ask me what my #1 > > issue is, it varies from week to week. :) > > > > Until the QOI issues are worked out, or at least reduced significantly, > > it's not clear that we'll be able to make any strong statements about the > > quality of the design. > > > > Later, > > Brad > Good point, particularly when you compare it with the QOI issues in C++ > as it was maturing. And the design, too. There were times when e.g. > nobody knew when an object ought to be destroyed. > Andrei Here's the thing: Unless you're developing a D compiler, there's no difference between a QoI issue and a language design issue. An issue is an issue, whether the fix is to change the design or to change the compiler. In my opinion, there's very little point in discussing a language's merit without discussing the tools. A design without an implementation has no worth. As Steve Yegge likes to say, a language's popularity is all about the tools. What's more constructive? Judging a language based on the Digital Mars Hypothetical Future D compiler, or based on DMD, GDC and LDC? What's the point of saying that a language has no flaws, but there are no implementations of that language?
Re: What does C++ do better than D? - StackOverflow.com
== Quote from Marco Leise (marco.le...@gmx.de)'s article > Am 02.08.2011, 01:51 Uhr, schrieb Walter Bright > : > > I've talked to many people who use logical const extensively in C++, and > > really want it. If you dig down into what's happening, you'll find that > > logical const isn't actually supported by C++. It's a convention. > > There's simply nothing in the language that enforces that convention. > > > > The reason "logical const" does not work with const in D is because D > > actually enforces const semantics, and relies on that enforcement. > > > > Since logical const is a convention in C++ anyway, you can have logical > > const in D, too. Just put in a comment: > > > > struct S /* This struct is logical const */ > > { ... } > > > > and then follow the convention just as you would with C++. > > > > Const in C++ is not powerful - it's simply a fraud - and the two get > > confused. > I can understand the point of view of the compiler developer and I don't > question that D const has advantages. It is definitly good to have > transitive const in some use cases. Until today I didn't even know about > logical const. But the more I think about it and its applications it looks > like a valuable feature. > I'm a typical OOP programmer and I generally avoid pointers where possible > and use encapsulation - that is - mark methods and data fields private. > But there are these strong cases where you cannot afford to have the usual > transitive const. Instead you really want a high-level logical const. One > that makes no sense to the compiler and is a 'fraud'. That is in OOP you > give away a const reference to some object, meaning that the outside world > cannot modify it logically. The encapsulated inner state though should not > be affected by this. > The example with the Matrix class is an excellent example. Here the > programmer wants to make sure that the owner of the Matrix can safely give > away that Matrix object without having to worry that the logical state > changes, i.e. the mathematical representation changes. This is the > 'caching' use case. > Another one I've found is object composition: > http://en.wikipedia.org/wiki/Object_composition#UML_notation > The motor in your car: If the car is a const reference the motor has to be > protected by that as well (composition). > But if I call car.getVendor() I expect the mutable instance of the vendor > object to call car.getVendor().buy(car.getModel(), 10) for my company's > car pool. > On this higher level C++ gives the form of logical protection for the > 'caching' case that I need as an OO programmer. > - Marco The problem as I see it is that D has two separate concepts that are conflated: const and immutable. In fact, I'd argue that immutable shouldn't even exist in its current standalone state but should rather be part of an ownership system a-la Bartosz' suggested annotation system. In the context of single threaded programs const mustn't be transitive. E.g. class Foo { int a; ... } class Bar { Foo foo; ...} void func(const Bar b); void gunc(immutable Bar b); func should be able to change b.foo.a but not b.foo (foo is head-const or "final") gunc however will enforce transitivity and will not allow to change b.foo.a In the context of multi-threaded programs, casting const(T) to an immutable(T) would require locking/synchronization in order to preserve correctness. To conclude, Instead of D's current model where both T and immutable(T) can be "up-casted" to const(T) I'm suggesting T -> const(T) -(locked)-> immutable(T) In addition, compile-time "manifest" consts via enum should be removed in favor of immutable.
Re: What does C++ do better than D? - StackOverflow.com
Am 02.08.2011, 01:51 Uhr, schrieb Walter Bright : I've talked to many people who use logical const extensively in C++, and really want it. If you dig down into what's happening, you'll find that logical const isn't actually supported by C++. It's a convention. There's simply nothing in the language that enforces that convention. The reason "logical const" does not work with const in D is because D actually enforces const semantics, and relies on that enforcement. Since logical const is a convention in C++ anyway, you can have logical const in D, too. Just put in a comment: struct S /* This struct is logical const */ { ... } and then follow the convention just as you would with C++. Const in C++ is not powerful - it's simply a fraud - and the two get confused. I can understand the point of view of the compiler developer and I don't question that D const has advantages. It is definitly good to have transitive const in some use cases. Until today I didn't even know about logical const. But the more I think about it and its applications it looks like a valuable feature. I'm a typical OOP programmer and I generally avoid pointers where possible and use encapsulation - that is - mark methods and data fields private. But there are these strong cases where you cannot afford to have the usual transitive const. Instead you really want a high-level logical const. One that makes no sense to the compiler and is a 'fraud'. That is in OOP you give away a const reference to some object, meaning that the outside world cannot modify it logically. The encapsulated inner state though should not be affected by this. The example with the Matrix class is an excellent example. Here the programmer wants to make sure that the owner of the Matrix can safely give away that Matrix object without having to worry that the logical state changes, i.e. the mathematical representation changes. This is the 'caching' use case. Another one I've found is object composition: http://en.wikipedia.org/wiki/Object_composition#UML_notation The motor in your car: If the car is a const reference the motor has to be protected by that as well (composition). But if I call car.getVendor() I expect the mutable instance of the vendor object to call car.getVendor().buy(car.getModel(), 10) for my company's car pool. On this higher level C++ gives the form of logical protection for the 'caching' case that I need as an OO programmer. - Marco
Re: What does C++ do better than D? - StackOverflow.com
Andrei Alexandrescu wrote: > I know how to fix the design (in fact the implementation, the > design is sound). It's just ever so difficult to find the time to > prioritize for it. What direction were you going? If it's a brief enough writeup I might be able to see where you were going and write the code myself. (I'm starting to get a feel for github too so I can to the whole pull request route!)
Re: What does C++ do better than D? - StackOverflow.com
On Monday 01 August 2011 21:28:51 Andrei Alexandrescu wrote: > On 8/1/11 9:09 PM, bearophile wrote: > > Andrei: > >> Mentioning these to the outside blows the issues out of proportion > >> and conveys the wrong message to someone coming anew to D. > > > > This is often true, unfortunately. But doing the opposite too has > > risks. If you keep saying only good things about a very complex > > systems X, people naturally start getting suspicious, because simply > > a so much complex system can't be perfect. > > I didn't advocate the opposite, and I don't think my response on SE was > only discussing the shiny city on the hill. Though I was pretty much accused of that in the reddit thread. :) - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
On 8/1/11 7:56 PM, Brad Roberts wrote: On Mon, 1 Aug 2011, Peter Alexander wrote: On 1/08/11 7:29 PM, Kagamin wrote: Walter Bright Wrote: Now on reddit! http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ C++ has a better thought out type system. Nice joke. http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html Please read my note at the end. I believe D (probably) has a better type system. It just wasn't very well though out. I believe many aspects of D's type system were added in without fully exploring the ramifications they had on other parts of the language. There are at least two pieces of evidence which support my belief: 1. The fact that you can't copy const struct objects containing reference types. 2. The fact that the root object still isn't const correct. C++ has some questionable choices for its type system, but it generally doesn't prevent you from getting work done. You're mixing state of implementation with design of the type system. Easy enough to conflate, but still a conflation of issues. Don't get me wrong, that there's QOI issues still is a real problem. I'd also agree that it's in the top 10 list of real problems. I don't know that I'd make it #1 on the list, though. Please don't ask me what my #1 issue is, it varies from week to week. :) Until the QOI issues are worked out, or at least reduced significantly, it's not clear that we'll be able to make any strong statements about the quality of the design. Later, Brad Good point, particularly when you compare it with the QOI issues in C++ as it was maturing. And the design, too. There were times when e.g. nobody knew when an object ought to be destroyed. Andrei
Re: What does C++ do better than D? - StackOverflow.com
On 8/1/11 8:29 PM, Andrei Alexandrescu wrote: On 8/1/11 6:30 PM, Adam Ruppe wrote: Peter Alexander wrote: 1. The fact that you can't copy const struct objects containing reference types. I recently hit a similar problem. web.d uses a ParameterTypeTuple to fill in arguments to the functions it calls in a generic way. With "in" arguments, assigning to the tuple isn't allowed! It says "can't modify const". I decided to just not use const in there, and cast it away in the wrapper function. I'm not happy with that, but I don't know what else to do. (I generally like D's const and immutable, but blarg there are some rough edges and I don't even know how to fix the design.) I know how to fix the design (in fact the implementation, the design is sound). It's just ever so difficult to find the time to prioritize for it. Overall I feel Peter's post on stackexchange did more bad than good (of course that doesn't mean he had the right; s/had/didn't have/ Andrei
Re: What does C++ do better than D? - StackOverflow.com
On 8/1/11 9:09 PM, bearophile wrote: Andrei: Mentioning these to the outside blows the issues out of proportion and conveys the wrong message to someone coming anew to D. This is often true, unfortunately. But doing the opposite too has risks. If you keep saying only good things about a very complex systems X, people naturally start getting suspicious, because simply a so much complex system can't be perfect. I didn't advocate the opposite, and I don't think my response on SE was only discussing the shiny city on the hill. Andrei
Re: What does C++ do better than D? - StackOverflow.com
Andrei: > Mentioning these to the outside blows the issues out of > proportion and conveys the wrong message to someone coming anew to D. This is often true, unfortunately. But doing the opposite too has risks. If you keep saying only good things about a very complex systems X, people naturally start getting suspicious, because simply a so much complex system can't be perfect. Such threads are always very messy. They are full of errors, good ideas, and everything else. I hope people do not believe everything said in such threads, both bad and good things. It's like a room full of people shouting, where half of them don't know what they are talking about :-) > Plus, C++'s type system is marred by issues, This is good information to know, thank you. I think most people need to write non obvious programs (like library code) both in C++ and D to understand some of the C++ problems you list, otherwise I think lot of programmers have difficulties understanding them in abstract, and they think D doesn't improve the situation enough compared to C++0x. D contains many improvements that are not easy to see. More articles that show D usage (compared to C++ too) are probably going to improve this a bit. Bye, bearophile
Re: What does C++ do better than D? - StackOverflow.com
On Monday 01 August 2011 18:02:11 Walter Bright wrote: > On 8/1/2011 5:58 PM, Jonathan M Davis wrote: > >> On 8/1/2011 5:07 PM, Jonathan M Davis wrote: > >>> You do get some gains from const in C++, but it's pretty much all > >>> gained by convention. It _is_ better than just comments in that the > >>> compiler will complain if you break the convention, forcing you to > >>> explicitly break it (e.g. via casting or mutable), but ultimately, > >>> it doesn't enforce much. I do believe that it enforces enough that > >>> it's worth having, but it obviously doesn't provide the guarantees > >>> that D's const does. > >> > >> Any code at any time can modify a mutable member of a const object, > >> without even bothering with the nicety of a cast. The notion that C++ > >> "supports" logical const is without merit. > > > > If an object isn't const, you can't call anything on it that isn't > > const. That does gain you some level of safety which is enforced by the > > compiler. > Those "const" functions can still change the mutable members without any > cast. Yes. I agree with you that C++ does not ultimately give you any guarantees, because you can use casting and mutable to completely circumvent const. However, I disagree with you if you think that const in C++ isn't ultimately any better than commenting your code to say that it's const. The compiler does enforce const on some level - it just gives you ways to completely circumvent it if you want to - so while it is ultimately a convention, it is on some level a compiler-enforced convention. So, it's better than comments. That's all I'm really trying to say. Just the other day, the fact that I use const heavily in C++ helped me catch bugs in my code where I had gotten the arguments to algorithm's copy function backwards. The fact that the source was const made it so that copy didn't compile. Without const, I would have had a much harder time catching my mistake. So yes. It's ultimately a fallacy to say that C++ has logical const. However, that doesn't mean that const in C++ is useless. And your posts on it at least give the impression that that's what you think. It does not give the same guarantees as D's const, but it does give you some (albeit much weaker guarantees) and is better than nothing. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
On 8/1/11 6:30 PM, Adam Ruppe wrote: Peter Alexander wrote: 1. The fact that you can't copy const struct objects containing reference types. I recently hit a similar problem. web.d uses a ParameterTypeTuple to fill in arguments to the functions it calls in a generic way. With "in" arguments, assigning to the tuple isn't allowed! It says "can't modify const". I decided to just not use const in there, and cast it away in the wrapper function. I'm not happy with that, but I don't know what else to do. (I generally like D's const and immutable, but blarg there are some rough edges and I don't even know how to fix the design.) I know how to fix the design (in fact the implementation, the design is sound). It's just ever so difficult to find the time to prioritize for it. Overall I feel Peter's post on stackexchange did more bad than good (of course that doesn't mean he had the right; I'm just writing this under the hypothesis he meant well and he'd be interested ). Within the confines of the community, discussing such issues is welcome and healthy. Mentioning these to the outside blows the issues out of proportion and conveys the wrong message to someone coming anew to D. Plus, C++'s type system is marred by issues, so the statement has correctness issues to start with. Const is a mix of storage type and type qualifier; even most experts have no idea about that, and the minority of experts who do know about the distinction have difficulty figuring which is in effect when. Type deduction with functions and const is essentially a collection of special cases. Pointer to member functions have a type, but it can't be named, spelled, or used. Functions taking char* still accept string literals (compilers increasingly override that, but the rule is in the standard for C's sake). There is no way to convert a void* to a pointer to function, meaning all dynamic loading facilities must operate outside the standard. There is no way to specify or figure out alignment. Slicing polymorphic objects is legit. And so on and so forth. C++'s type system problems have been trodden over a million times and they might have became as invisible as that carpet stain in the hallway. That doesn't mean they're not there. Andrei
Re: What does C++ do better than D? - StackOverflow.com
On 8/1/2011 5:58 PM, Jonathan M Davis wrote: On 8/1/2011 5:07 PM, Jonathan M Davis wrote: You do get some gains from const in C++, but it's pretty much all gained by convention. It _is_ better than just comments in that the compiler will complain if you break the convention, forcing you to explicitly break it (e.g. via casting or mutable), but ultimately, it doesn't enforce much. I do believe that it enforces enough that it's worth having, but it obviously doesn't provide the guarantees that D's const does. Any code at any time can modify a mutable member of a const object, without even bothering with the nicety of a cast. The notion that C++ "supports" logical const is without merit. If an object isn't const, you can't call anything on it that isn't const. That does gain you some level of safety which is enforced by the compiler. Those "const" functions can still change the mutable members without any cast.
Re: What does C++ do better than D? - StackOverflow.com
On Mon, 1 Aug 2011, Peter Alexander wrote: > On 1/08/11 7:29 PM, Kagamin wrote: > > Walter Bright Wrote: > > > > > Now on reddit! > > > > > > http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ > > > > C++ has a better thought out type system. > > Nice joke. > > http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html > > Please read my note at the end. I believe D (probably) has a better type > system. It just wasn't very well though out. > > I believe many aspects of D's type system were added in without fully > exploring the ramifications they had on other parts of the language. There are > at least two pieces of evidence which support my belief: > > 1. The fact that you can't copy const struct objects containing reference > types. > > 2. The fact that the root object still isn't const correct. > > > C++ has some questionable choices for its type system, but it generally > doesn't prevent you from getting work done. You're mixing state of implementation with design of the type system. Easy enough to conflate, but still a conflation of issues. Don't get me wrong, that there's QOI issues still is a real problem. I'd also agree that it's in the top 10 list of real problems. I don't know that I'd make it #1 on the list, though. Please don't ask me what my #1 issue is, it varies from week to week. :) Until the QOI issues are worked out, or at least reduced significantly, it's not clear that we'll be able to make any strong statements about the quality of the design. Later, Brad
Re: What does C++ do better than D? - StackOverflow.com
> On 8/1/2011 5:07 PM, Jonathan M Davis wrote: > > You do get some gains from const in C++, but it's pretty much all gained > > by convention. It _is_ better than just comments in that the compiler > > will complain if you break the convention, forcing you to explicitly > > break it (e.g. via casting or mutable), but ultimately, it doesn't > > enforce much. I do believe that it enforces enough that it's worth > > having, but it obviously doesn't provide the guarantees that D's const > > does. > > Any code at any time can modify a mutable member of a const object, without > even bothering with the nicety of a cast. The notion that C++ "supports" > logical const is without merit. If an object isn't const, you can't call anything on it that isn't const. That does gain you some level of safety which is enforced by the compiler. But since you can completely side step it via a cast (or by having a mutable member variable), you don't really get any guarantees. However, that minimal support _is_ still better than nothing IMHO. So, C++ supports const in that sense. But yes. You're right that logical const isn't much more than a convention. The fact that C++ has mutable helps support the convention, but it's still ultimately a convention. Still, the fact that the compiler does have some level of enforcement for const does add something of value. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
On 8/1/2011 5:07 PM, Jonathan M Davis wrote: You do get some gains from const in C++, but it's pretty much all gained by convention. It _is_ better than just comments in that the compiler will complain if you break the convention, forcing you to explicitly break it (e.g. via casting or mutable), but ultimately, it doesn't enforce much. I do believe that it enforces enough that it's worth having, but it obviously doesn't provide the guarantees that D's const does. Any code at any time can modify a mutable member of a const object, without even bothering with the nicety of a cast. The notion that C++ "supports" logical const is without merit.
Re: What does C++ do better than D? - StackOverflow.com
> On 8/1/2011 4:36 PM, Jonathan M Davis wrote: > > You lose logical const, which he has wanted to use in stuff that he's > > been doing (games I think). He wants to lazy load values in his objects. > > You can't do that with D's const. It pretty much means that that you > > have to either eager load it or give up on const. It's totally doable, > > but it forces you to change your design in a manner which you might not > > like. > > I've talked to many people who use logical const extensively in C++, and > really want it. If you dig down into what's happening, you'll find that > logical const isn't actually supported by C++. It's a convention. There's > simply nothing in the language that enforces that convention. > > The reason "logical const" does not work with const in D is because D > actually enforces const semantics, and relies on that enforcement. > > Since logical const is a convention in C++ anyway, you can have logical > const in D, too. Just put in a comment: > > struct S /* This struct is logical const */ > { ... } > > and then follow the convention just as you would with C++. > > Const in C++ is not powerful - it's simply a fraud - and the two get > confused. You do get some gains from const in C++, but it's pretty much all gained by convention. It _is_ better than just comments in that the compiler will complain if you break the convention, forcing you to explicitly break it (e.g. via casting or mutable), but ultimately, it doesn't enforce much. I do believe that it enforces enough that it's worth having, but it obviously doesn't provide the guarantees that D's const does. It seems to me that it would be possible to have logical const in D - at least as far as lazy loading goes - if a feature were added to allow for a member variable to be set the first time that it's accessed (you've essentially just delayed the initialization of that particular variable). Obviously, it would have to be disallowed when immutable is involved (or eagerly loaded in the case of immutable). Syntactically, it would probably be something like lazy int var = initializeFunc(); The initialization then takes place when var is first used rather than at compile time. Now, that could be very nasty to implement, and I'm not at all suggesting that we consider such a feature right now (if anything, it would probable be a D3 feature), but it seems to me that it should be posible to add a mechanism to the language specifically for the lazy loading of member variables which worked even when the first time that the variable was accessed was in a const function. Whether it's worth the time and effort it would take to implement it, let alone the complication that it would add to the language, I don't know. But it's at least theoretically possible. The reality of the situation at the moment though is that D actually fully enforces const (unlike C++), so it can't really even fake having logical const (unlike C++), so you just can't use const in some situations in D where you would in C++. It's certainly annoying sometimes, but in general, the gains far outweigh the cost IMHO. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
On 8/1/2011 4:36 PM, Jonathan M Davis wrote: You lose logical const, which he has wanted to use in stuff that he's been doing (games I think). He wants to lazy load values in his objects. You can't do that with D's const. It pretty much means that that you have to either eager load it or give up on const. It's totally doable, but it forces you to change your design in a manner which you might not like. I've talked to many people who use logical const extensively in C++, and really want it. If you dig down into what's happening, you'll find that logical const isn't actually supported by C++. It's a convention. There's simply nothing in the language that enforces that convention. The reason "logical const" does not work with const in D is because D actually enforces const semantics, and relies on that enforcement. Since logical const is a convention in C++ anyway, you can have logical const in D, too. Just put in a comment: struct S /* This struct is logical const */ { ... } and then follow the convention just as you would with C++. Const in C++ is not powerful - it's simply a fraud - and the two get confused.
Re: What does C++ do better than D? - StackOverflow.com
> On 1/08/11 7:29 PM, Kagamin wrote: > > Walter Bright Wrote: > >> Now on reddit! > >> > >> http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_ > >> d/ > > > > C++ has a better thought out type system. > > Nice joke. > > http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html > > > > Please read my note at the end. I believe D (probably) has a better type > > system. It just wasn't very well though out. > > > > I believe many aspects of D's type system were added in without fully > > exploring the ramifications they had on other parts of the language. > > There are at least two pieces of evidence which support my belief: > > > > 1. The fact that you can't copy const struct objects containing > > reference types. > > You can copy them, but not to mutable. In exchange, you get transitive > const. > > > 2. The fact that the root object still isn't const correct. > > I think it could be. It would just force everyone implementing opEquals to > be const correct too. Or is there any other fundamental issue? The primary issues are actually doing the work to make it const-correct and the fact that if the compiler's handling of const is buggy, it could really screw over Object - and thus all classes. So, the bug has sat there for a long time. I'm not sure that there are really any issues with it at this point other than taking the time to do it though. > > C++ has some questionable choices for its type system, but it generally > > doesn't prevent you from getting work done. > > I have not yet been affected by any of your two issues. Do you have example > use cases where they prevent you from getting work done? You lose logical const, which he has wanted to use in stuff that he's been doing (games I think). He wants to lazy load values in his objects. You can't do that with D's const. It pretty much means that that you have to either eager load it or give up on const. It's totally doable, but it forces you to change your design in a manner which you might not like. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
> On 1/08/11 7:29 PM, Kagamin wrote: > > Walter Bright Wrote: > >> Now on reddit! > >> > >> http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_ > >> d/ > > > > C++ has a better thought out type system. > > Nice joke. > > http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html > > Please read my note at the end. I believe D (probably) has a better type > system. It just wasn't very well though out. > > I believe many aspects of D's type system were added in without fully > exploring the ramifications they had on other parts of the language. > There are at least two pieces of evidence which support my belief: > > 1. The fact that you can't copy const struct objects containing > reference types. > > 2. The fact that the root object still isn't const correct. > > > C++ has some questionable choices for its type system, but it generally > doesn't prevent you from getting work done. C++ is also a lot older. It's had more time to sort out its type system. It also has a simpler type system. So, any issues that it had have long since been resolved. D just hasn't had the same time to sort through all of the issues in its type system. It'll get there soon enough though. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
Peter Alexander wrote: > 1. The fact that you can't copy const struct objects containing > reference types. I recently hit a similar problem. web.d uses a ParameterTypeTuple to fill in arguments to the functions it calls in a generic way. With "in" arguments, assigning to the tuple isn't allowed! It says "can't modify const". I decided to just not use const in there, and cast it away in the wrapper function. I'm not happy with that, but I don't know what else to do. (I generally like D's const and immutable, but blarg there are some rough edges and I don't even know how to fix the design.)
Re: What does C++ do better than D? - StackOverflow.com
On 1/08/11 7:29 PM, Kagamin wrote: > Walter Bright Wrote: > >> Now on reddit! >> >> http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ > > C++ has a better thought out type system. > Nice joke. > http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html > > Please read my note at the end. I believe D (probably) has a better type > system. It just wasn't very well though out. > > I believe many aspects of D's type system were added in without fully > exploring the ramifications they had on other parts of the language. > There are at least two pieces of evidence which support my belief: > > 1. The fact that you can't copy const struct objects containing > reference types. You can copy them, but not to mutable. In exchange, you get transitive const. > > 2. The fact that the root object still isn't const correct. > I think it could be. It would just force everyone implementing opEquals to be const correct too. Or is there any other fundamental issue? > > C++ has some questionable choices for its type system, but it generally > doesn't prevent you from getting work done. I have not yet been affected by any of your two issues. Do you have example use cases where they prevent you from getting work done? -Timon
Re: What does C++ do better than D? - StackOverflow.com
On 1/08/11 7:29 PM, Kagamin wrote: Walter Bright Wrote: Now on reddit! http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ C++ has a better thought out type system. Nice joke. http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html Please read my note at the end. I believe D (probably) has a better type system. It just wasn't very well though out. I believe many aspects of D's type system were added in without fully exploring the ramifications they had on other parts of the language. There are at least two pieces of evidence which support my belief: 1. The fact that you can't copy const struct objects containing reference types. 2. The fact that the root object still isn't const correct. C++ has some questionable choices for its type system, but it generally doesn't prevent you from getting work done.
Re: What does C++ do better than D? - StackOverflow.com
Kagamin: > C++ has a better thought out type system. > Nice joke. > http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html C++ compiled with Clang *is* better, because D doesn't catch this bug: int kMaxDiskSpace1 = 10 << 30; This is somewhat worse, because it gives even more false security: long kMaxDiskSpace2 = 10 << 30; I'll never agree that D is doing well enough here. Bye, bearophile
Re: What does C++ do better than D? - StackOverflow.com
On Aug 2, 11 02:29, Kagamin wrote: Walter Bright Wrote: Now on reddit! http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ C++ has a better thought out type system. Nice joke. http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html Note that D fails to catch the 2nd error (sizediff_t kMaxDiskSpace = 10 << 30) either.
Re: What does C++ do better than D? - StackOverflow.com
Walter Bright Wrote: > Now on reddit! > > http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ C++ has a better thought out type system. Nice joke. http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html
Re: What does C++ do better than D? - StackOverflow.com
On Sat, 30 Jul 2011 16:25:22 -0400, Nick Sabalausky wrote: What does C++ do better than D? It's better at giving you enough time during a compile to grab a sandwich and a latte, and generally goof off with the excuse "Can't do anything else right now - it's compiling". Boo to D, for making me have to be productive! And thinner! bastards! -Steve
Re: What does C++ do better than D? - StackOverflow.com
"Adam Ruppe" wrote in message news:j14cui$2vig$1...@digitalmars.com... >> Hmm...? So what is "this app path thing"? I take it you're not >> talking about the PATH environment variable? > > It's a registry section. Here's the blog post I saw it in: > > http://blogs.msdn.com/b/oldnewthing/archive/2011/07/25/10189298.aspx God, how convoluted. Leave it to MS to "simplify" a situation by making it more complex. And nevemind the fact that the autoexec.bat issues aren't applicable in Win2k and onward. This also means that the incredibly useful tango.sys.Environment.exePath is essentially broken, and if it were fixed then this would likely break: if(Environment.exePath(appName)) system(appName); else doSomethingAboutItLikeMaybeInstallItOrSomething(); Kinda drives you to Linux until you remember that making a persistent change to the user's PATH over there is just like the autoexec.bat situation, except worse because at least with autoexec.bat it was always the same interpreter and anything more complex than a greppable one-line "set PATH=..." was rare. Anyway, that's very good to know. Thanks.
Re: What does C++ do better than D? - StackOverflow.com
On 7/31/11, Adam Ruppe wrote: > Try "start wordpad" > That works. I don't think it's useful if we have to use `start` all the time though..
Re: What does C++ do better than D? - StackOverflow.com
Try "start wordpad"
Re: What does C++ do better than D? - StackOverflow.com
At least on my system, I can run wordpad from start>run, but in a console window wordpad isn't found.
Re: What does C++ do better than D? - StackOverflow.com
On 7/31/11, Adam D. Ruppe wrote: > (copy/pasting something that came to mind but is irrelevant for > the reddit) > > A note on the registry, in case the windows installer maintainer is reading > this: > the installer should use it. If it puts dmd in the app path key, it *should* > be > able to run without modifying the path. > > c:\whatever> start dmd [args] > > ought to work. dmd finds the linker relative to its own directory so it > doesn't > need to be in the path. > > > I recently read about this app path thing on Raymond Chen's blog > and I think it might be useful here. I've heard people having > trouble setting the path on windows before so just throwing > it out here. > App path only works for the Run dialog in the start menu.
Re: What does C++ do better than D? - StackOverflow.com
> Hmm...? So what is "this app path thing"? I take it you're not > talking about the PATH environment variable? It's a registry section. Here's the blog post I saw it in: http://blogs.msdn.com/b/oldnewthing/archive/2011/07/25/10189298.aspx
Re: What does C++ do better than D? - StackOverflow.com
"Adam D. Ruppe" wrote in message news:j140so$2bf8$1...@digitalmars.com... > (copy/pasting something that came to mind but is irrelevant for > the reddit) > > A note on the registry, in case the windows installer maintainer is > reading this: > the installer should use it. If it puts dmd in the app path key, it > *should* be > able to run without modifying the path. > > c:\whatever> start dmd [args] > > ought to work. dmd finds the linker relative to its own directory so it > doesn't > need to be in the path. > > > I recently read about this app path thing on Raymond Chen's blog > and I think it might be useful here. I've heard people having > trouble setting the path on windows before so just throwing > it out here. Hmm...? So what is "this app path thing"? I take it you're not talking about the PATH environment variable?
Re: What does C++ do better than D? - StackOverflow.com
(copy/pasting something that came to mind but is irrelevant for the reddit) A note on the registry, in case the windows installer maintainer is reading this: the installer should use it. If it puts dmd in the app path key, it *should* be able to run without modifying the path. c:\whatever> start dmd [args] ought to work. dmd finds the linker relative to its own directory so it doesn't need to be in the path. I recently read about this app path thing on Raymond Chen's blog and I think it might be useful here. I've heard people having trouble setting the path on windows before so just throwing it out here.
Re: What does C++ do better than D? - StackOverflow.com
It lists the .zip, but there is *zero* indication that A. it includes pre-built binaries, or that B. you can just unzip and use. I bet most people (expecually Linux users) just assume that's a source-only distro, since that's what multiplatform zips usually are. Yes I (Linux user) did assume that and I would welcome a source only package some time. It's such a waste of bandwidth to download the binaries when you are just interested in the sources. Oh and add this awesome bash-completion script from the Ubuntu package to it! If that's not an option the description could say "source + binaries, all platforms".
Re: What does C++ do better than D? - StackOverflow.com
On Sunday 31 July 2011 12:47:20 Peter Alexander wrote: > On 31/07/11 6:17 AM, Jonathan M Davis wrote: > > On Sunday 31 July 2011 00:04:33 Caligo wrote: > >> 7k views in one day, now that's just epic. 2011 might as be the year > >> for D. > > > > However, the vote count isn't anywhere near 7k, so either people are > > deciding not to vote, or (more likely) it's seeing a lot of views from > > people who don't normally visit the site and don't have accounts > > (probably at least in part due to the post on reddit). > > That vote/view ratio is fairly standard on SE. 50 up votes is very good. > > You are probably right about people not having accounts and being unable > to vote. Also, lots of people simply don't bother voting. Oh, 50 is huge. However, glancing around, it looked to me like the ratio was much more heavily towards views than is with the case with many other questions. I didn't exactly do a detailed study on it though, so maybe a ratio of 7k views / 50 votes is quite normal. Regardless, 50 upvotes is a lot. The question is getting a lot of attention and a lot of votes. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
On 31/07/11 6:17 AM, Jonathan M Davis wrote: On Sunday 31 July 2011 00:04:33 Caligo wrote: 7k views in one day, now that's just epic. 2011 might as be the year for D. However, the vote count isn't anywhere near 7k, so either people are deciding not to vote, or (more likely) it's seeing a lot of views from people who don't normally visit the site and don't have accounts (probably at least in part due to the post on reddit). That vote/view ratio is fairly standard on SE. 50 up votes is very good. You are probably right about people not having accounts and being unable to vote. Also, lots of people simply don't bother voting.
Re: What does C++ do better than D? - StackOverflow.com
On Sunday 31 July 2011 00:04:33 Caligo wrote: > 7k views in one day, now that's just epic. 2011 might as be the year for D. However, the vote count isn't anywhere near 7k, so either people are deciding not to vote, or (more likely) it's seeing a lot of views from people who don't normally visit the site and don't have accounts (probably at least in part due to the post on reddit). - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
7k views in one day, now that's just epic. 2011 might as be the year for D.
Re: What does C++ do better than D? - StackOverflow.com
"Peter Alexander" wrote in message news:j129s3$29oh$1...@digitalmars.com... > On 31/07/11 12:38 AM, Andrei Alexandrescu wrote: >> On 07/30/2011 03:37 PM, Walter Bright wrote: >>> On 7/30/2011 1:19 PM, Andrei Alexandrescu wrote: You may want to kindly message the moderators to approve manually - the post has been autobanned. >>> >>> Done. >> >> It's up. Comment away! >> >> http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ >> >> >> Andrei > > It appears there's still a lot of outdated negative views of D in the > wild. Hopefully with enough time (and corrections!) these views will > disappear. Definitely, but some of them are understandable and indicate areas of improvement for us. For example, there's a lot mentioned about difficulties installing/compiling DMD. Now yes, it *is* simple: Just unzip and use. *BUT*: 1. There is *no* way to know that from the download page: http://www.digitalmars.com/d/download.html It lists the .zip, but there is *zero* indication that A. it includes pre-built binaries, or that B. you can just unzip and use. I bet most people (expecually Linux users) just assume that's a source-only distro, since that's what multiplatform zips usually are. 2. The precompiled binaries don't work on systems with an older glibc, so some people do need to recompile. 3. Figuring out how to compile DMD *is* a royal pain in the ass. It doesn't help that instructions for doing so are missing from the readme (in either the release or git). And it also doesn't help that instructions found online are always either incomplete or outdated. I am working on this though via some new features to DVM, but they're not quite ready for prime-time yet: https://bitbucket.org/Abscissa256/dvm Speaking of, at some point DVM should probably be mentioned on the download page, since it's a simple, easy, cross-platform way to install DMD.
Re: What does C++ do better than D? - StackOverflow.com
On 31/07/11 12:38 AM, Andrei Alexandrescu wrote: On 07/30/2011 03:37 PM, Walter Bright wrote: On 7/30/2011 1:19 PM, Andrei Alexandrescu wrote: You may want to kindly message the moderators to approve manually - the post has been autobanned. Done. It's up. Comment away! http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ Andrei It appears there's still a lot of outdated negative views of D in the wild. Hopefully with enough time (and corrections!) these views will disappear.
Re: What does C++ do better than D? - StackOverflow.com
Ugh, I hate seeing so much factually wrong stuff. It's one thing to have different opinions, but half the anti-D folks remind me of myself circa 2003. I went to digitalmars.com to update my copy of the 16 bit C compiler (yes, I used that thing for a long time. Sometimes still do!). I saw a link to D on the side and took a look. Then I saw "import" instead of "#include" and said "gross too much like Java, me hate." Of course, I didn't say any of that publicly, but I didn't take a second look at D until a few couple years later, and then I moved past my different = worse bias. I think most the redditers are still in that kneejerk different means bad phase and haven't actually looked back at D for a long time after being scared away at the first sight, and now latch on to whatever "information" they find to reinforce and justify their fear.
Re: What does C++ do better than D? - StackOverflow.com
On 07/30/2011 03:37 PM, Walter Bright wrote: On 7/30/2011 1:19 PM, Andrei Alexandrescu wrote: You may want to kindly message the moderators to approve manually - the post has been autobanned. Done. It's up. Comment away! http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ Andrei
Re: What does C++ do better than D? - StackOverflow.com
On Saturday 30 July 2011 10:16:49 bearophile wrote: > Jonathan M Davis: > > This is part 7 of your answer: > >Member functions of classes are polymorphic by default. You can't declare > >them non-virtual. It's up to the compiler to decide if they can be (which > >really is only the case if they're final and aren't overriding a function > >from a base class). So, that could be a performance problem in some > >cases. However, if you really don't need the polymorphism, then all you > >have to do is use structs, and it's not an issue.< > > Do you want to declare a class member non-virtual but non-final too? In cases where a function is not overriding another function and there isn't currently a class which derives from that class or there isn't currently a function in a derived class which overrides it, it would be nice if it weren't virtual. For a variety of reasons, that's not feasible, and I think that D is, overall, making the correct decision about virtuality. However, from the perspective of a C++ programmer just learning D, forcing virtual on every class member function except in cases where the compiler might optimize the virtuality out under the hood could definitely be viewed as a negative. struct pretty much solves the problem, since if you didn't really want polymorphism (which would generally by why you wouldn't declare a function virtual), it does what you want. But from the perspective of a C++ programmer wanting maximum control, the situation with virtual functions in D _could_ be viewed as a downside, hence why I mentioned it. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
On 7/30/2011 1:19 PM, Andrei Alexandrescu wrote: You may want to kindly message the moderators to approve manually - the post has been autobanned. Done.
Re: What does C++ do better than D? - StackOverflow.com
"Andrei Alexandrescu" wrote in message news:j11p0f$1fq7$1...@digitalmars.com... > On 07/30/2011 12:58 PM, Walter Bright wrote: >> Now on reddit! >> >> http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ > > You may want to kindly message the moderators to approve manually - the > post has been autobanned. > We need an auto-request-manual-approve.
Re: What does C++ do better than D? - StackOverflow.com
> What does C++ do better than D? It's better at giving you enough time during a compile to grab a sandwich and a latte, and generally goof off with the excuse "Can't do anything else right now - it's compiling". Boo to D, for making me have to be productive!
Re: What does C++ do better than D? - StackOverflow.com
On 07/30/2011 12:58 PM, Walter Bright wrote: Now on reddit! http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/ You may want to kindly message the moderators to approve manually - the post has been autobanned. Andrei
Re: What does C++ do better than D? - StackOverflow.com
On 7/30/2011 3:22 AM, Jonathan M Davis wrote: Ouch. Now you're going to make me think. My first reaction is to answer "nothing," but there almost has to be _something_. At the moment, however, I have no clue what that could be. I'll definitely have to think about this one. You wrote a nice reply there. Well done!
Re: What does C++ do better than D? - StackOverflow.com
Now on reddit! http://www.reddit.com/r/programming/comments/j48tf/how_is_c_better_than_d/
Re: What does C++ do better than D? - StackOverflow.com
bearophile Wrote: > Jonathan M Davis: > > This is part 7 of your answer: > > >Member functions of classes are polymorphic by default. You can't declare > >them non-virtual. It's up to the compiler to decide if they can be (which > >really is only the case if they're final and aren't overriding a function > >from a base class). So, that could be a performance problem in some cases. > >However, if you really don't need the polymorphism, then all you have to do > >is use structs, and it's not an issue.< > > Do you want to declare a class member non-virtual but non-final too? > > Bye, > bearophile Yes, because I like chioce and I chuze to spell words fishsticks.
Re: What does C++ do better than D? - StackOverflow.com
On 30/07/11 1:09 PM, Jonathan M Davis wrote: On Saturday 30 July 2011 12:43:34 Klaim - Joël Lamotte wrote: On Sat, Jul 30, 2011 at 12:22, Jonathan M Davis wrote: Ouch. Now you're going to make me think. My first reaction is to answer "nothing," but there almost has to be _something_. At the moment, however, I have no clue what that could be. I'll definitely have to think about this one. - Jonathan M Davis Yes, obviously it's a hard and very interesting question and I wanted that the most concerned people participate to answer it. The most voted answer have been edited to make sure it's not a rant anymore, with more clear explainations. I agree with some points but I'm sure I'll agree with points from the other side. So far no answer from the D community so I'm not satisfied :) Well, for better or worse, I have now posted a very long answer to the question. - Jonathan M Davis I also posted my thoughts, although I think I was a bit more negative towards D than you were :-)
Re: What does C++ do better than D? - StackOverflow.com
Jeff Nowakovski wrote: > On 07/30/2011 07:16 AM, Alix Pexton wrote: >> >> Looks like that "current most voted answer" got some heavy edits to make >> it more objective. I didn't see the original, but what I read was full >> of misconceptions. He didn't really do much in these edits. He exchanged some offensive, uninformed statements that looked offensive for some uninformed statements that are still offensive but don't look offensive anymore. > > Since the "current most voted answer" has changed to one that hasn't > been edited, I don't even know which post you are talking about. There > is a "link" to individual answers that you can copy. > > Also, while I really don't think conversations should be wikis or > editable, you can see the history for posts and get back to the original. It is the post that starts with its own summary: http://programmers.stackexchange.com/questions/97207/what-does-c-do-better-than-d/97211#97211
Re: What does C++ do better than D? - StackOverflow.com
On 07/30/2011 07:16 AM, Alix Pexton wrote: Looks like that "current most voted answer" got some heavy edits to make it more objective. I didn't see the original, but what I read was full of misconceptions. Since the "current most voted answer" has changed to one that hasn't been edited, I don't even know which post you are talking about. There is a "link" to individual answers that you can copy. Also, while I really don't think conversations should be wikis or editable, you can see the history for posts and get back to the original.
Re: What does C++ do better than D? - StackOverflow.com
Jonathan M Davis: This is part 7 of your answer: >Member functions of classes are polymorphic by default. You can't declare them >non-virtual. It's up to the compiler to decide if they can be (which really is >only the case if they're final and aren't overriding a function from a base >class). So, that could be a performance problem in some cases. However, if you >really don't need the polymorphism, then all you have to do is use structs, >and it's not an issue.< Do you want to declare a class member non-virtual but non-final too? Bye, bearophile
Re: What does C++ do better than D? - StackOverflow.com
On Sat, 30 Jul 2011 15:11:35 +0300, Jonathan M Davis wrote: Looks like that "current most voted answer" got some heavy edits to make it more objective. I didn't see the original, but what I read was full of misconceptions. It's now better worded than it was, and it's less offensively written than it was, but it's still saying pretty much the same thing. He clearly doesn't know what he's talking about. He appears to have had some friends who tried out D and had issues with it. That combined with an instant dislike of anything which differs from C++ seems to have led to a generally negative impression, and for whatever reason, he feels the need to be very vocal about it. - Jonathan M Davis The guy has absolutely no idea about D and from his ideas on C++ i doubt he knows much about it either, but he still won't shut up. "I have to disagree. Who wrote that foreword is totally irrelevant- what matters is why they wrote it, and I don't see any justification. Trying to use such a thing as evidence is violation of basic objectivity" Objectivity? Is it something like not knowing a single thing about a language then writing a 2 pages essay on it? Let alone D or C++ guy also clueless about what objectivity means. All there is left to think is he is doing it on purpose. Is there a better example for a troll or an uninformed fanboy?
Re: What does C++ do better than D? - StackOverflow.com
On Saturday 30 July 2011 12:16:46 Alix Pexton wrote: > On 30/07/2011 11:22, Jonathan M Davis wrote: > > On Saturday 30 July 2011 11:43:29 Klaim - Joël Lamotte wrote: > >> Hi, > >> > >> I just wanted to point this question to make sure there are feedbacks > >> from several points of view. > >> Some points in the current most voted answer are interesting and I > >> guess > >> some people here will want to comment it. > >> However I don't think it's a very good idea, It would be better to > >> just try to post the most pragmatic and useful answer to the original > >> question: > >> > >> http://programmers.stackexchange.com/questions/97207/what-does-c-do-be > >> tter-t han-d > > > > Ouch. Now you're going to make me think. My first reaction is to answer > > "nothing," but there almost has to be _something_. At the moment, > > however, I have no clue what that could be. I'll definitely have to > > think about this one. > > > > - Jonathan M Davis > > Looks like that "current most voted answer" got some heavy edits to make > it more objective. I didn't see the original, but what I read was full > of misconceptions. It's now better worded than it was, and it's less offensively written than it was, but it's still saying pretty much the same thing. He clearly doesn't know what he's talking about. He appears to have had some friends who tried out D and had issues with it. That combined with an instant dislike of anything which differs from C++ seems to have led to a generally negative impression, and for whatever reason, he feels the need to be very vocal about it. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
On Saturday 30 July 2011 12:43:34 Klaim - Joël Lamotte wrote: > On Sat, Jul 30, 2011 at 12:22, Jonathan M Davis wrote: > > Ouch. Now you're going to make me think. My first reaction is to answer > > "nothing," but there almost has to be _something_. At the moment, > > however, I > > have no clue what that could be. I'll definitely have to think about > > this > > one. > > > > - Jonathan M Davis > > Yes, obviously it's a hard and very interesting question and I wanted that > the most concerned people participate to answer it. > > The most voted answer have been edited to make sure it's not a rant anymore, > with more clear explainations. > I agree with some points but I'm sure I'll agree with points from the other > side. So far no answer from the D community so I'm not satisfied :) Well, for better or worse, I have now posted a very long answer to the question. - Jonathan M Davis
Re: What does C++ do better than D? - StackOverflow.com
On 30/07/2011 11:22, Jonathan M Davis wrote: On Saturday 30 July 2011 11:43:29 Klaim - Joël Lamotte wrote: Hi, I just wanted to point this question to make sure there are feedbacks from several points of view. Some points in the current most voted answer are interesting and I guess some people here will want to comment it. However I don't think it's a very good idea, It would be better to just try to post the most pragmatic and useful answer to the original question: http://programmers.stackexchange.com/questions/97207/what-does-c-do-better-t han-d Ouch. Now you're going to make me think. My first reaction is to answer "nothing," but there almost has to be _something_. At the moment, however, I have no clue what that could be. I'll definitely have to think about this one. - Jonathan M Davis Looks like that "current most voted answer" got some heavy edits to make it more objective. I didn't see the original, but what I read was full of misconceptions. If I were to reply to the OP, I'd say that the one thing that C++ does better than D is confuse new-comers, but that simply shows that I do not have enough experience with C++ to know what it does well (if anything). A...
Re: What does C++ do better than D? - StackOverflow.com
On Sat, Jul 30, 2011 at 12:22, Jonathan M Davis wrote: > > Ouch. Now you're going to make me think. My first reaction is to answer > "nothing," but there almost has to be _something_. At the moment, however, > I > have no clue what that could be. I'll definitely have to think about this > one. > > - Jonathan M Davis > Yes, obviously it's a hard and very interesting question and I wanted that the most concerned people participate to answer it. The most voted answer have been edited to make sure it's not a rant anymore, with more clear explainations. I agree with some points but I'm sure I'll agree with points from the other side. So far no answer from the D community so I'm not satisfied :) Joël Lamotte
Re: What does C++ do better than D? - StackOverflow.com
On Saturday 30 July 2011 11:43:29 Klaim - Joël Lamotte wrote: > Hi, > > I just wanted to point this question to make sure there are feedbacks from > several points of view. > Some points in the current most voted answer are interesting and I guess > some people here will want to comment it. > However I don't think it's a very good idea, It would be better to just try > to post the most pragmatic and useful answer to the original question: > > http://programmers.stackexchange.com/questions/97207/what-does-c-do-better-t > han-d Ouch. Now you're going to make me think. My first reaction is to answer "nothing," but there almost has to be _something_. At the moment, however, I have no clue what that could be. I'll definitely have to think about this one. - Jonathan M Davis
What does C++ do better than D? - StackOverflow.com
Hi, I just wanted to point this question to make sure there are feedbacks from several points of view. Some points in the current most voted answer are interesting and I guess some people here will want to comment it. However I don't think it's a very good idea, It would be better to just try to post the most pragmatic and useful answer to the original question: http://programmers.stackexchange.com/questions/97207/what-does-c-do-better-than-d Joël Lamotte