www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [OT] Walter's anecdotes

reply Dennis <dkorpel gmail.com> writes:
Brian Tiffin asked in the thread [Do you use D's 
GC?](https://forum.dlang.org/post/gthgnueerizzgirfpmrt forum.dlang.org) "Does
anyone have a Walter's Wisdoms file?"

Since I like reading Walter Bright's anecdotes and experiences 
from the past, I made a compilation of the ones I found on this 
forum. Enjoy!

 Hey, anyone can ignore me and go ahead and do it that way. I 
 wish you the best of luck - sometimes us old coots are dead 
 wrong - but forgive me if I'm not going to be terribly 
 sympathetic if you ignore my advice and things go badly!
[Quote](https://forum.dlang.org/post/kgmk55$2evj$1 digitalmars.com) https://forum.dlang.org/post/cv0otb$1lmn$1 digitaldaemon.com Back in the ancient times, when dinosaurs and C ruled, I was looking for a way to set my C compiler (Datalight C) apart from the crowd. I ran across Objective-C by Stepstone and C++ by AT&T. Both were used about equally, and there was fierce debate about which one was going to be the future. But Stepstone wanted royalties for anyone wanting to do Objective-C. I contacted AT&T, and they graciously said I could implement a C++ compiler, call it C++, and not pay royalties to AT&T. (They also thanked me for being the only one who ever bothered to even ask!) That settled it for me, C++ was the future. https://forum.dlang.org/post/l006cj$1h2c$1 digitalmars.com Back in the bad old Datalight C days, I relied on the Microsoft linker which came on the DOS system disks. Unfortunately, Microsoft constantly changed it, even with the same version of DOS. Worse, numerous other Microsoft products came with yet other versions of LINK.EXE. All those linkers behaved differently. It was a frackin' nightmare to support customers with them. I used to have floppy disks packed full of just different versions of LINK.EXE. This drove me to get our own linker (BLINK.EXE). While it wasn't perfect, either, at least I could actually fix problems with it rather than throwing up my hands in rage being unable to control the situation. https://forum.dlang.org/post/nh5urp$1qf3$1 digitalmars.com https://forum.dlang.org/post/lolj3d$nsq$1 digitalmars.com An anecdote: a colleague of mine was once doing a chained calculation. At every step, he rounded to 2 digits of precision after the decimal point, because 2 digits of precision was enough for anybody. I carried out the same calculation to the max precision of the calculator (10 digits). He simply could not understand why his result was off by a factor of 2, which was a couple hundred times his individual roundoff error. https://forum.dlang.org/post/ms7gs7$272a$1 digitalmars.com https://forum.dlang.org/post/pmktna$1hgo$1 digitalmars.com
 In my experience you can deliver
 everything people say they want, and then find it isn't that at 
 all.
My favorite anecdote on that was back in the 1990's. A friend of mine said that what he and the world really needs was a Java native compiler. It'd be worth a fortune! I told him that I had that idea a while back, and had implemented one for Symantec. I could get him a copy that day. He changed the subject. https://forum.dlang.org/post/naoqo8$d52$1 digitalmars.com I've been (falsely) accused of stealing code in the past, even once accused of having stolen the old Datalight C compiler from some BYU students. Once a game company stole Empire, and then had the astonishing nerve to sic their lawyers on me accusing me of stealing it from them! (Showing them my registered copyright of the source code that predated their claim by 10 years was entertaining.) https://forum.dlang.org/post/nj3f1q$2mcu$1 digitalmars.com https://forum.dlang.org/post/pmktna$1hgo$1 digitalmars.com Related to me by a friend: X told me that what he really wanted in a C++ compiler was compile speed. It was the most important feature. He went on and on about it. I laughed and said that compile speed was at the bottom of his list. He looked perplexed, and asked how could I say that? I told him that he was using Cfront, a translator, with Microsoft C as the backend, a combination that compiled 4 times slower than Zortech C++, and didn't have critical (for DOS) features like near/far pointers. What he really regarded as the most important feature was being a name brand. https://forum.dlang.org/post/ol0eoh$2bbh$1 digitalmars.com Back in the 80's (!) computer magazines regularly ran C compiler benchmark results. (At one time I counted 30 C compilers available for the PC.) I took a class at Standford on compilers, which included a lot of info on data flow analysis. I decided to implement it. Data flow analysis optimizations basically deleted the benchmark code, because it didn't do anything (lots of dead assignments). This compiler was released as Datalight Optimum C. The article writer concluded that the compiler had a giant bug in it, because it ran the benchmarks impossibly fast, because it deleted the dead code. Instead of being lauded as the only C compiler on the PC that did global data flow analysis, it was labeled as a buggy piece of crap. By the time we dug ourselves out of that PR disaster, other compilers had implemented it, too. Ironically, these days DMD gets repeatedly charged with not doing data flow analysis, and clang is assumed to have invented data flow analysis. Just goes to show the power of marketing :-) https://forum.dlang.org/post/pk2gv6$28g4$1 digitalmars.com You'd be amazed at what people do and then set their entire store based on it. If the language spec allows it, people will do it. People will even design their code to require certain bugs in the compiler. (This really blows when you're trying to write a standard compliant C/C++ compiler and you get angry letters from customers about why I'm not supporting some stupid bug in BrandX C++ that they rely on.) One of my favorite stories about this was a company that had a coding style where their comments looked like this: //******** text ********\\ int x; They thought it was marvelous! But what really happens when you've got two line concatenation characters at the end? Is one line concatenated, or two? You have to carefully read the spec to determine which, and it matters because if two are concatenated then the declaration of x vanishes. And BrandX did it wrong, the customer wrote all their code this way, and it all broke with my compiler, and of course it was all my fault. I thought "who in their right mind would write code that way?" At least I could justify myself with BrandX is a buggy compiler, but when the behavior is in the spec, I have no leg to stand on. If we want to support interfacing with C++, we have to support badly written C++, because that is the NORMAL case. Telling them their code is **** and that they should rewrite it in order to work with D is never, ever going to work. Another anecdote - Microsoft MASM in the 80's was full of bugs. I mean full of bugs. When Borland came out with an assembler, it wouldn't work with most of the ASM files out there. They finally had to engineer in what they called "quirks mode" to emulate MASM's bugs. Telling customers to rework their ASM files didn't work for a large company, either. https://forum.dlang.org/post/rljdoi$dcj$1 digitalmars.com Professional C Standard library implementations tend to be hideous code to perform objectively simple operations. The reason is speed is so desirable in foundational code that it drives out all other considerations. (memcpy() is a standout example.) I remember back in the 80's when Borland came out with Turbo C. The compiler didn't generate very good code, but applications built with it were reasonably fast. How was this done? Borland carefully implemented the C library in hand-optimized assembler by some very good programmers. Even printf was coded this way. The speedups gained there sped up every Turbo C program. At the time, nobody else had done that. Much as I hate to admit it, Borland made the smart move there.
Aug 05
next sibling parent zjh <fqbqrr 163.com> writes:
On Thursday, 5 August 2021 at 17:46:22 UTC, Dennis wrote:
 Brian Tiffin asked in the thread [Do you use D's GC?]
[中文版轶事](https://fqbqrr.blog.csdn.net/article/details/104215037)
Aug 05
prev sibling next sibling parent Brian Tiffin <btiffin gnu.org> writes:
On Thursday, 5 August 2021 at 17:46:22 UTC, Dennis wrote:
 Brian Tiffin asked in the thread [Do you use D's 
 GC?](https://forum.dlang.org/post/gthgnueerizzgirfpmrt forum.dlang.org) "Does
anyone have a Walter's Wisdoms file?"
And here's the one that caused me to interrupt the other thread... Do you use D's GC? ------------------ There's some good replies here. When I write high performance code, I use a mix of manual and GC allocation. Stuff that's critical for performance or recycling memory, I use manual. For not critical stuff, like setup and configuration code, I use the GC because it's so much more convenient. BTW, regardless of what language you use, or use GC or not, there's no way to write a high performance program without being cognizant of its memory consumption patterns.
Aug 06
prev sibling next sibling parent user1234 <user1234 12.de> writes:
On Thursday, 5 August 2021 at 17:46:22 UTC, Dennis wrote:
 Brian Tiffin asked in the thread [Do you use D's 
 GC?](https://forum.dlang.org/post/gthgnueerizzgirfpmrt forum.dlang.org) "Does
anyone have a Walter's Wisdoms file?"

 Since I like reading Walter Bright's anecdotes and experiences 
 from the past, I made a compilation of the ones I found on this 
 forum. Enjoy!
thanks, I think there's another you have missed but unfortunately I dont find where the source anymore. It's about a lawyer who once rang at his door trying to make him admit he stole some code or violated a patent or something like that... then Walter adviced to people to take care in this case of situation and to never admit anything because it can be some simple traps. Maybe I've read this on HN. Do you confirm you've experienced such a situation Walter ?
Aug 06
prev sibling next sibling parent Guillaume Piolat <first.last gmail.com> writes:
On Thursday, 5 August 2021 at 17:46:22 UTC, Dennis wrote:
 Brian Tiffin asked in the thread [Do you use D's 
 GC?](https://forum.dlang.org/post/gthgnueerizzgirfpmrt forum.dlang.org) "Does
anyone have a Walter's Wisdoms file?"

 Since I like reading Walter Bright's anecdotes and experiences 
 from the past, I made a compilation of the ones I found on this 
 forum. Enjoy!
https://forum.dlang.org/post/bvrsfvbjqyodkrqtlkif forum.dlang.org
Aug 06
prev sibling next sibling parent Dukc <ajieskola gmail.com> writes:
On Thursday, 5 August 2021 at 17:46:22 UTC, Dennis wrote:
 Brian Tiffin asked in the thread [Do you use D's 
 GC?](https://forum.dlang.org/post/gthgnueerizzgirfpmrt forum.dlang.org) "Does
anyone have a Walter's Wisdoms file?"

 Since I like reading Walter Bright's anecdotes and experiences 
 from the past, I made a compilation of the ones I found on this 
 forum. Enjoy!
I do too! Thanks for these. For those who don't know, here is an entire collection of articles by Walter: https://www.digitalmars.com/articles/
Aug 07
prev sibling next sibling parent Dukc <ajieskola gmail.com> writes:
More links to Walter's posts:

On DVD player quality: 
https://forum.dlang.org/post/pmdgsp$rqg$1 digitalmars.com
On psychology in language design: 
https://forum.dlang.org/post/p210u8$qn2$1 digitalmars.com
Very Walter analogue on handling null dereferences: 
https://forum.dlang.org/post/lbcmef$1c1k$1 digitalmars.com
Some general tips: 
https://forum.dlang.org/post/nuptoj$22d3$1 digitalmars.com
Aug 07
prev sibling next sibling parent Mark <mt.rzezniczak gmail.com> writes:
On Thursday, 5 August 2021 at 17:46:22 UTC, Dennis wrote:

 https://forum.dlang.org/post/rljdoi$dcj$1 digitalmars.com


 ...


 Borland carefully implemented the C library in hand-optimized 
 assembler by some very good programmers. Even printf was coded 
 this way. The speedups gained there sped up every Turbo C 
 program. At the time, nobody else had done that.

 Much as I hate to admit it, Borland made the smart move there.
I admit it as well. If only we could apply the same principle to a society as well? How would that work? Humans are a bit more complicated than computers though. They can lie, disinformation is harmful.
Aug 08
prev sibling parent reply Mark <mt.rzezniczak gmail.com> writes:
Just to add to that. Does DMD use the standard library (phobos)? 
It doesn't so any optimizations in phobos won't get passed down 
to DMD because it uses a small run down library that no one 
really keeps up to date. DMD should start using phobos I think. 
That might be a good place to start with making DMD faster.
Aug 08
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 09/08/2021 12:56 PM, Mark wrote:
 Just to add to that. Does DMD use the standard library (phobos)? It 
No.
 doesn't so any optimizations in phobos won't get passed down to DMD 
 because it uses a small run down library that no one really keeps up to 
That bit of code is probably older than me... (and that's a good thing).
 date. DMD should start using phobos I think. That might be a good place 
 to start with making DMD faster.
Unlikely to improve performance, the things that are slow should not be in phobos. All it does is introduce new requirements for bootstrapping it which is rather bad news long term.
Aug 08
parent Mark <mt.rzezniczak gmail.com> writes:
On Monday, 9 August 2021 at 01:03:55 UTC, rikki cattermole wrote:
 On 09/08/2021 12:56 PM, Mark wrote:
 Just to add to that. Does DMD use the standard library 
 (phobos)? It
No.
 doesn't so any optimizations in phobos won't get passed down 
 to DMD because it uses a small run down library that no one 
 really keeps up to
That bit of code is probably older than me... (and that's a good thing).
Yes it is good for legacy, it is robust. But because the code is so old, no one keeps it up to date and optimized like they are doing with phobos. So it is also a weakness.
 date. DMD should start using phobos I think. That might be a 
 good place to start with making DMD faster.
Unlikely to improve performance, the things that are slow should not be in phobos. All it does is introduce new requirements for bootstrapping it which is rather bad news long term.
So how do we make it easier long term while still working on it short term?
Aug 09