Re: From the D Blog: Crafting Self-Evident Code in D
On Saturday, 7 October 2023 at 12:37:37 UTC, sighoya wrote: I disagree however in all binary types should be just boolean. I prefer machineState=State.On or State.Off than isMachineOn=true or false. This was finished possible: ```d import std; enum State : bool { Off, On } void main() { State machineState; "The machine ".write; if(machineState == State.On) { "may be ".write; } machineState = State.On; if(machineState == State.On) { "definitely ".write; } "runnning!".writeln; // BONUS: TriState int engineHP = -500; "The engine ".write; final switch(engineHP.sgn) { case TriState.Off: "was off!".writeln; break; case TriState.Start: "was start!".writeln; break; case TriState.On: "running!".writeln; break; } } enum TriState { Off = -1, Start, On } ``` SDB79
Re: From the D Blog: Crafting Self-Evident Code in D
On 10/26/2023 2:30 AM, John Colvin wrote: Good talk. Many very clever people would achieve more if they tried to understand why a v. experienced developer would care to spend so much time talking about what might appear to be such basic points. The key challenge: If this stuff was so obvious & everyone did it or it didn't matter so much that they didn't, why would Walter care about it so much? Like user interfaces in an airplane cockpit, it all looks obvious. But, as I was told by the lead engineer for the 757 cockpit, every aspect of it was paid for with somebody's blood.
Re: From the D Blog: Crafting Self-Evident Code in D
On Monday, 2 October 2023 at 17:28:19 UTC, Mike Parker wrote: It's been a long, long while since I published anything on the blog. I do intend to get pick it up again down the road, but Walter recently surprised me with plans of his own. He's taken the topic of his DConf '23 talk and derived a blog post from it: https://dlang.org/blog/2023/10/02/crafting-self-evident-code-with-d/ I guess he got impatient with the pace at which I'm getting the talk videos uploaded :-) And for anyone who'd like to engage in any Reddit discussion that comes up: https://www.reddit.com/r/programming/comments/16y2h36/crafting_selfevident_code_in_dlang/ Good talk. Many very clever people would achieve more if they tried to understand why a v. experienced developer would care to spend so much time talking about what might appear to be such basic points. The key challenge: If this stuff was so obvious & everyone did it or it didn't matter so much that they didn't, why would Walter care about it so much?
Re: From the D Blog: Crafting Self-Evident Code in D
On Thursday, 26 October 2023 at 03:15:00 UTC, Walter Bright wrote: On 10/4/2023 12:50 PM, claptrap wrote: Yes he can do what he likes, nobody has the right to demand anything from him. But his position and experience and knowledge is such that him doing a talk on coding guidelines is disappointing. Considering how few people follow the coding guidelines I presented, it's worthwhile. It isn't the usual guidelines I see, either. Fwiw, I thought it was a good talk, because this is the kind of thing many people ignore because they think it's "trivial". But what I have learned over 25 years of coding is that less is always more. The best code is code that can be understood. Don't try to be cleaver. It's almost always a bad idea.