From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: Ada needs some modernization Date: Wed, 1 Jun 2022 21:00:31 +0200 Organization: A noiseless patient Spider Message-ID: References: <75d90749-242f-42b8-ba0b-299f7ac693e0n@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 1 Jun 2022 19:00:33 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="fd0902e16dcce8edaa19b32350322c66"; logging-data="15688"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DHrRj2z7WWEPFPAm4iQ9b84QGY3uhkDQ=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cancel-Lock: sha1:yAxzWTtJy5tISVBjxb2K4srAtlE= In-Reply-To: <75d90749-242f-42b8-ba0b-299f7ac693e0n@googlegroups.com> Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:63903 List-Id: On 2022-05-31 19:54, Matt Borchers wrote: > > What amendment can we suggest to the Ada syntax so the if expression be better written when used in an if statement? I know other languages support this and it often looks like A ? B : C or something similar. That's certainly not Ada-like IMO, but I can't think of something better. These same languages often also have a null check operator A ?? B (where A and B are access types of the the same Type) such that if A is not null then A is returned otherwise B is returned. So useful and helpful! What you call "modernization" looks to me a lot like "repeating mistakes that Ritchie made over 50 years ago". "A ? B : C"? Or is it "A : B ? C"? If only there were a less cryptic, easier to remember and understand way to express it. Something like "(if A then B else C)", for example. "A ?? B" might be "useful and helpful" if you use (or think in) a language with pointers to objects everywhere, but in a language where such pointers are never needed, like Ada, it is neither, especially since a conditional expression would handle it just fine if it were ever needed. > I often find myself writing a loop to search ... When you write something for a second time, it's a signal to create a subprogram or package to avoid writing it a third time. -- Jeff Carter "You empty-headed animal-food-trough wiper." Monty Python & the Holy Grail 04