www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - C and memory safety comments by me

reply Walter Bright <newshound2 digitalmars.com> writes:
https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_will_kill_c/dhkxhef/
May 18 2017
next sibling parent reply David Gileadi <gileadisNOSPM gmail.com> writes:
On 5/18/17 10:00 AM, Walter Bright wrote:
 https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_
ill_kill_c/dhkxhef/ 
Oddly enough that link took me to a comment thread about Rust CFFI, with no comments by you in it. Perhaps you meant the link to not include the dhkxhef/ at the end?
May 18 2017
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 5/18/2017 10:08 AM, David Gileadi wrote:
 On 5/18/17 10:00 AM, Walter Bright wrote:
 https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_will_kill_c/dhkxhef/
Oddly enough that link took me to a comment thread about Rust CFFI, with no comments by you in it. Perhaps you meant the link to not include the dhkxhef/ at the end?
Yes, sorry about that. Corrected link: https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_will_kill_c/
May 18 2017
parent reply Joakim <dlang joakim.fea.st> writes:
On Thursday, 18 May 2017 at 17:25:24 UTC, Walter Bright wrote:
 On 5/18/2017 10:08 AM, David Gileadi wrote:
 On 5/18/17 10:00 AM, Walter Bright wrote:
 https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_will_kill_c/dhkxhef/
Oddly enough that link took me to a comment thread about Rust CFFI, with no comments by you in it. Perhaps you meant the link to not include the dhkxhef/ at the end?
Yes, sorry about that. Corrected link: https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_will_kill_c/
Looks like it's being discussed on r/rust too: https://www.reddit.com/r/rust/comments/6bpg90/systems_programming_panel_at_dconf2017_walter/ I think you got lucky that WannaCry hit soon after DConf, people are ready to talk about this now and your comments are spurring that discussion.
May 18 2017
next sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 5/18/2017 10:42 AM, Joakim wrote:
 On Thursday, 18 May 2017 at 17:25:24 UTC, Walter Bright wrote:
 On 5/18/2017 10:08 AM, David Gileadi wrote:
 On 5/18/17 10:00 AM, Walter Bright wrote:
 https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_will_kill_c/dhkxhef/
Oddly enough that link took me to a comment thread about Rust CFFI, with no comments by you in it. Perhaps you meant the link to not include the dhkxhef/ at the end?
Yes, sorry about that. Corrected link: https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_will_kill_c/
Looks like it's being discussed on r/rust too: https://www.reddit.com/r/rust/comments/6bpg90/systems_programming_panel_at_dconf2017_walter/ I think you got lucky that WannaCry hit soon after DConf, people are ready to talk about this now and your comments are spurring that discussion.
Thanks for the link. I don't understand what they mean in saying I don't get Rust's vision.
May 18 2017
parent reply Wulfklaue <wulfklaue wulfklaue.com> writes:
On Thursday, 18 May 2017 at 19:33:25 UTC, Walter Bright wrote:
 Thanks for the link. I don't understand what they mean in 
 saying I don't get Rust's vision.
A lot of Rust users seem to think they own the memory safe market. Language with GC = Bad. What they forget is that a good GC can be unnoticeable in code execution. Take these silly benchmarks: https://github.com/kostya/benchmarks Despite Rust not being a GC language, you expect the Rust results to have a lower memory usage then D. Or D to have a larger execution time for the lower memory ( early GC cleanup cycles = lower memory usage but performance hits ). The D Ldc vs Rust are the most relevant as its the same backend. But even with DMD or GCC those cpu/mem results can be better then Rust. Even Crystal pushes better results on the same backend. But i was under the assumption that anything that is not Rust is simply bad? /s
May 19 2017
parent reply Tobias Mueller <troplin bluewin.ch> writes:
On Friday, 19 May 2017 at 08:58:33 UTC, Wulfklaue wrote:
 On Thursday, 18 May 2017 at 19:33:25 UTC, Walter Bright wrote:
 Thanks for the link. I don't understand what they mean in 
 saying I don't get Rust's vision.
A lot of Rust users seem to think they own the memory safe market. Language with GC = Bad. What they forget is that a good GC can be unnoticeable in code execution. Take these silly benchmarks: https://github.com/kostya/benchmarks Despite Rust not being a GC language, you expect the Rust results to have a lower memory usage then D. Or D to have a larger execution time for the lower memory ( early GC cleanup cycles = lower memory usage but performance hits ). The D Ldc vs Rust are the most relevant as its the same backend. But even with DMD or GCC those cpu/mem results can be better then Rust. Even Crystal pushes better results on the same backend. But i was under the assumption that anything that is not Rust is simply bad? /s
I wonder, did you actually read the comments in linked thread in /r/rust? I don't see any that would support that. The comments about D are actually fairly positive in that thread. And Walter, I believe they wrote that you dont *buy into* the vision of Rust, not that you don't get the vision of Rust. The vision of Rust and D are quite different, so this isn't unexpected. They do however say that the actual knowledge about Rust in the D community seems to be rather small, compared to the amount of criticism against it. And TBQH I have to agree. To criticize, you should at least have a basic understanding of it. I don't really understand why there is so much bashing of other languages on this forum (not just Rust, but also Java, C, C++, etc). For me personally, this leaves a bad taste and makes the D community look unfriendly. There's room for both, Rust and D. Some just don't want a GC, for whatever valid or invalid reason. And some like it. Some like the terseness of D and others the explicitness of Rust. Some prefer the declarative nature of Rust, others the introspection of D. As I see it, Rust and D might target similar problems, but as a language they are quite different. If another language get's a good feature, the comments here are almost always negative. Why? Programming languages are tools, not religions (at least for most programmers). If the tools are getting better it's better for everyone. If other languages are including features of D, be happy about it, not angry. And similarly, D should try to learn from other languages and maybe even include some of their features it it fits.
May 19 2017
next sibling parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Friday, 19 May 2017 at 13:35:07 UTC, Tobias Mueller wrote:
 On Friday, 19 May 2017 at 08:58:33 UTC, Wulfklaue wrote:
 On Thursday, 18 May 2017 at 19:33:25 UTC, Walter Bright wrote:
 Thanks for the link. I don't understand what they mean in 
 saying I don't get Rust's vision.
A lot of Rust users seem to think they own the memory safe market. Language with GC = Bad. What they forget is that a good GC can be unnoticeable in code execution. Take these silly benchmarks: https://github.com/kostya/benchmarks Despite Rust not being a GC language, you expect the Rust results to have a lower memory usage then D. Or D to have a larger execution time for the lower memory ( early GC cleanup cycles = lower memory usage but performance hits ). The D Ldc vs Rust are the most relevant as its the same backend. But even with DMD or GCC those cpu/mem results can be better then Rust. Even Crystal pushes better results on the same backend. But i was under the assumption that anything that is not Rust is simply bad? /s
I wonder, did you actually read the comments in linked thread in /r/rust? I don't see any that would support that. The comments about D are actually fairly positive in that thread.
I believe he is poking fun at "the typical Reddit Rustacean".
May 19 2017
prev sibling next sibling parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 5/19/17 9:35 AM, Tobias Mueller wrote:

 They do however say that the actual knowledge about Rust in the D
 community seems to be rather small, compared to the amount of criticism
 against it. And TBQH I have to agree. To criticize, you should at least
 have a basic understanding of it.
The comments about Andrei saying Rust can't call into C or have C call back are quite harsh. Looking at Rust's ability to call C API, it seems they have a point -- it appears to be just like D in that you just declare an extern C function and can call it. Disclaimer: have never used Rust. -Steve
May 19 2017
next sibling parent bachmeier <no spam.net> writes:
On Friday, 19 May 2017 at 13:45:04 UTC, Steven Schveighoffer 
wrote:
 On 5/19/17 9:35 AM, Tobias Mueller wrote:

 They do however say that the actual knowledge about Rust in 
 the D
 community seems to be rather small, compared to the amount of 
 criticism
 against it. And TBQH I have to agree. To criticize, you should 
 at least
 have a basic understanding of it.
The comments about Andrei saying Rust can't call into C or have C call back are quite harsh. Looking at Rust's ability to call C API, it seems they have a point -- it appears to be just like D in that you just declare an extern C function and can call it. Disclaimer: have never used Rust. -Steve
Yep. It's easy both to call C and to call Rust from other languages. http://rustbyexample.com/std_misc/ffi.html http://zsiciarz.github.io/24daysofrust/book/vol1/day23.html
May 19 2017
prev sibling parent reply Patrick Schluter <Patrick.Schluter bbox.fr> writes:
On Friday, 19 May 2017 at 13:45:04 UTC, Steven Schveighoffer 
wrote:
 On 5/19/17 9:35 AM, Tobias Mueller wrote:

 They do however say that the actual knowledge about Rust in 
 the D
 community seems to be rather small, compared to the amount of 
 criticism
 against it. And TBQH I have to agree. To criticize, you should 
 at least
 have a basic understanding of it.
The comments about Andrei saying Rust can't call into C or have C call back are quite harsh. Looking at Rust's ability to call C API, it seems they have a point -- it appears to be just like D in that you just declare an extern C function and can call it. Disclaimer: have never used Rust.
What I've noticed is that Andrei and sometimes Walter do say C but mean C++ (note that the C++ files in the dmd code have only .c extension, not the usual .cpp). That is also why I had to make that remark the other day to be careful to not conflate C and C++ as they are really very different. The old canard that C is a subset of C++ was never true and has always been imo te thing that made C++ the Frankenstein monster it evolved into.
May 19 2017
parent Walter Bright <newshound2 digitalmars.com> writes:
On 5/19/2017 2:38 PM, Patrick Schluter wrote:
 The old canard that C
 is a subset of C++ was never true and has always been imo te thing that made
C++
 the Frankenstein monster it evolved into.
It's not true from a pedantic standpoint, but it is from a practical one. Although this has become slightly less true over time as the languages have evolved independently.
May 19 2017
prev sibling next sibling parent bachmeier <no spam.net> writes:
On Friday, 19 May 2017 at 13:35:07 UTC, Tobias Mueller wrote:

 I don't really understand why there is so much bashing of other 
 languages on this forum (not just Rust, but also Java, C, C++, 
 etc). For me personally, this leaves a bad taste and makes the 
 D community look unfriendly.
 There's room for both, Rust and D. Some just don't want a GC, 
 for whatever valid or invalid reason. And some like it. Some 
 like the terseness of D and others the explicitness of Rust. 
 Some prefer the declarative nature of Rust, others the 
 introspection of D.
 As I see it, Rust and D might target similar problems, but as a 
 language they are quite different.
I'm not sure I see a lot of bashing of other languages take place here. On the second part of your comment, I'd not only agree, but I'd say Rust is good for D. The two languages are simply too far apart to appeal to the same programmers. That means D can specialize and go deeply in its area, with no pressure to do what Rust is doing. You can call one from the other, so I don't see a problem. D is not a company, it is a language, and the focus should be on being as good as possible in one area. It's no longer 1980 where you have to use C for things it was not designed to do.
May 19 2017
prev sibling parent reply Jonathan M Davis via Digitalmars-d <digitalmars-d puremagic.com> writes:
On Friday, May 19, 2017 1:35:07 PM PDT Tobias Mueller via Digitalmars-d 
wrote:
 I don't really understand why there is so much bashing of other
 languages on this forum (not just Rust, but also Java, C, C++,
 etc). For me personally, this leaves a bad taste and makes the D
 community look unfriendly.
Well, for languages like Java, C, and C++, it's mostly a result of folks using those languages and being unhappy with them (which is then often why they end up using D - it addresses a number of their complaints about thos languages). As for complaining about Rust, from what I've seen, it's mostly either being unhappy with Rust's syntax - which is a perfectly valid reason not to like a language. The problem comes in if you start complaining about the users of such languages, and occasionally there's bashing in here about that, which isn't good. But there certainly could be plenty more complaining about Rust here that I haven't seen. I suspect that there is some resentment floating around here though about the massive attention that Rust has gotten, whereas D generally hasn't gotten all that much attention by the programming community at large. Another thing to keep in mind about language bashing though, is that the D community tends to do a lot of bashing about D. Much as we love D, there's a lot of complaining about various aspects that aren't perfect (I think in part because mant came to D hoping for their perfect language, and seeing it get really close to where you want but not quite there can be quite frustrating). So, it's not like the D community is constantly bashing other languages, claiming that D is perfect. We tend to bash any aspect of any language that we don't like - D included.
 There's room for both, Rust and D. Some just don't want a GC, for
 whatever valid or invalid reason. And some like it. Some like the
 terseness of D and others the explicitness of Rust. Some prefer
 the declarative nature of Rust, others the introspection of D.
 As I see it, Rust and D might target similar problems, but as a
 language they are quite different.
I think that there's totally room for multiple languages out there - including both D and Rust, but that doesn't mean that folks aren't going to complain about the aspects languages that they don't like. And ultimately, the fact that we have variety helps give folks the opportunity to find a language that fits their tastes. I think that D vs Go is an even greater example of this (and before folks were comparing Rust and D, they really liked to compare Go and D). D and Go are drastically different languages to ther point that about the only reasons that they were compared so much are because the were both new, and because Go inititally called itself a systems programming language like C/C++ and D do - but the Go guys meant something completely different by system (which is why they eventually stopped calling themselves that). D and Go clearly both have followings, but because of how different they are, odds are that someone who really likes one is not going to be a fan of the other. They're simply too different. But there's no reason why they can't both exist and thrive.
 If another language get's a good feature, the comments here are
 almost always negative. Why? Programming languages are tools, not
 religions (at least for most programmers). If the tools are
 getting better it's better for everyone. If other languages are
 including features of D, be happy about it, not angry.
I haven't usually seen complaints about other languages getting new features. The only thing along those lines that I've seen much of is some folks getting annoyed because C++ added a feature that D had had for quite a while, and the D community almost never gets credit for ite Now, sometimes, those ideas really were arrived at separately, but some are so uniquely D that the odds of them having not been inspired by D are _very_ low. So, there's sometimes resentment over that. But if anything, the fact that that's happening just goes to show that D has some cool stuff that other languages might want too. Regardless, I don't recall anyone complaining simply because another language was improved in some way.
 And similarly, D should try to learn from other languages and
 maybe even include some of their features it it fits.
A _lot_ of D's featues have been inspired by other languages (e.g. slicing dynamic arrays and nested functions both exist in D, because Walter saw them in other langauges and liked them), and there have been plenty of occasions where another language's feature has been discussed for inclusion in D (e.g. Defined Attributes were added, because folks had seen them in other languages and wanted them in D). In some respects, D is the poster child language of learning from other langauges, because so much of what we have was inspired by other languages or is explicitly an improvement over something that another langauge did (e.g. there are a lot of things in D - Jonathan M Davis
May 19 2017
next sibling parent jmh530 <john.michael.hall gmail.com> writes:
On Friday, 19 May 2017 at 14:18:33 UTC, Jonathan M Davis wrote:
 (e.g. slicing dynamic arrays and nested functions both exist in 
 D, because Walter saw them in other langauges and liked them),
The first languages I learned all had array slicing built-in (Matlab/R/Python). You wouldn't believe the litany of functions that are required in Armadillo to try to get the same functionality in C++ that comes so naturally in those languages.
May 19 2017
prev sibling next sibling parent reply Tobias Mueller <troplin bluewin.ch> writes:
On Friday, 19 May 2017 at 14:18:33 UTC, Jonathan M Davis wrote:
 Well, for languages like Java, C, and C++, it's mostly a result 
 of folks using those languages and being unhappy with them 
 (which is then often why they end up using D - it addresses a 
 number of their complaints about thos languages).
I'm a (mostly) C++ programmer as my day job and I'm well aware of its shortcomings. Still I like parts of it and I tend to get offended by comments that make me feel like some stick-in-the-mud idiot who still uses C++. Often it's just the tone. And while those comments are probably not as frequent as I suggested, they still exist and they are not opposed, so this is what sticks.
 Another thing to keep in mind about language bashing though, is 
 that the D community tends to do a lot of bashing about D. Much 
 as we love D, there's a lot of complaining about various 
 aspects that aren't perfect (I think in part because mant came 
 to D hoping for their perfect language, and seeing it get 
 really close to where you want but not quite there can be quite 
 frustrating). So, it's not like the D community is constantly 
 bashing other languages, claiming that D is perfect. We tend to 
 bash any aspect of any language that we don't like - D included.
There's a big difference between criticizing a language (or anything else, that is) in its own community vs in another community. People tend to get defensive in the latter case.
 I haven't usually seen complaints about other languages getting 
 new features. The only thing along those lines that I've seen 
 much of is some folks getting annoyed because C++ added a 
 feature that D had had for quite a while, and the D community 
 almost never gets credit for ite Now, sometimes, those ideas 
 really were arrived at separately, but some are so uniquely D 
 that the odds of them having not been inspired by D are _very_ 
 low. So, there's sometimes resentment over that. But if 
 anything, the fact that that's happening just goes to show that 
 D has some cool stuff that other languages might want too. 
 Regardless, I don't recall anyone complaining simply because 
 another language was improved in some way.
Maybe it's just me hearing things, but often those comments seem to imply that it's worthless to add the feature to C++, because it already exists in D and they haven't even done it right in C++. But as a C++ programmer I welcome every feature that helps me to write better code, I don't care where it comes from. I don't have the choice to switch to another language.
 A _lot_ of D's featues have been inspired by other languages 
 (e.g. slicing dynamic arrays and nested functions both exist in 
 D, because Walter saw them in other langauges and liked them), 
 and there have been plenty of occasions where another 
 language's feature has been discussed for inclusion in D (e.g. 

 and User Defined Attributes were added, because folks had seen 
 them in other languages and wanted them in D). In some 
 respects, D is the poster child language of learning from other 
 langauges, because so much of what we have was inspired by 
 other languages or is explicitly an improvement over something 
 that another langauge did (e.g. there are a lot of things in D 
 that are there to learn from and improve on C, C++, Java, and 

I honestly don't know the history of D and programming languages in general enough to judge that, but I strikes me as odd that the main language designers know so little about their (assumed) main competitor. I imagine that if I would design a language, I would probably try to understand every existing language and take the best out of each. Especially if another language gets a lot of attention, like Rust currently, I'd probably want to know why and not just blame it to hype or corporate backing.
May 19 2017
parent Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= writes:
On Friday, 19 May 2017 at 15:20:49 UTC, Tobias Mueller wrote:
 I imagine that if I would design a language, I would probably 
 try to understand every existing language and take the best out 
 of each.
Mmm, yes, people who know what exists realize that the design they come up with is just a rehash of a 30 year old language... So they go for something new, which does not appeal to current day programmers who are predominantly trained on concepts that are 40 years old...
May 19 2017
prev sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 5/19/2017 7:18 AM, Jonathan M Davis via Digitalmars-d wrote:
 A _lot_ of D's featues have been inspired by other languages (e.g. slicing
 dynamic arrays and nested functions both exist in D, because Walter saw them
 in other langauges and liked them),
Array slicing is an idea by Jan Knepper. Nested functions were about the only thing I liked about early Pascal, and I sorely missed them in C.
May 19 2017
prev sibling parent Joakim <dlang joakim.fea.st> writes:
On Thursday, 18 May 2017 at 17:42:39 UTC, Joakim wrote:
 On Thursday, 18 May 2017 at 17:25:24 UTC, Walter Bright wrote:
 On 5/18/2017 10:08 AM, David Gileadi wrote:
 On 5/18/17 10:00 AM, Walter Bright wrote:
 https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_will_kill_c/dhkxhef/
Oddly enough that link took me to a comment thread about Rust CFFI, with no comments by you in it. Perhaps you meant the link to not include the dhkxhef/ at the end?
Yes, sorry about that. Corrected link: https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_will_kill_c/
Looks like it's being discussed on r/rust too: https://www.reddit.com/r/rust/comments/6bpg90/systems_programming_panel_at_dconf2017_walter/ I think you got lucky that WannaCry hit soon after DConf, people are ready to talk about this now and your comments are spurring that discussion.
Looks like the Rust guys are publicizing memory safety more: https://motherboard.vice.com/en_us/article/a3mgxb/the-internet-has-a-huge-cc-problem-and-developers-dont-want-to-deal-with-it
Nov 18 2018
prev sibling parent Joakim <dlang joakim.fea.st> writes:
On Thursday, 18 May 2017 at 17:00:11 UTC, Walter Bright wrote:
 https://www.reddit.com/r/cpp/comments/6b4xrc/walter_bright_believes_memory_safety_will_kill_c/dhkxhef/
Heh, that explains all the views of that video, making it the most-viewed DConf talk, which I was confused about before: http://forum.dlang.org/post/qanggnfamgjwdigjuxot forum.dlang.org
May 18 2017