From mboxrd@z Thu Jan 1 00:00:00 1970 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ichbiah 2022 compiler mode Date: Sat, 21 Dec 2024 02:14:00 -0600 Organization: A noiseless patient Spider Message-ID: References: Injection-Date: Sat, 21 Dec 2024 09:14:02 +0100 (CET) Injection-Info: dont-email.me; posting-host="a539143aaaf8e240cfd1c441013bf73f"; logging-data="4154014"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hRdmT4OzV34ZzlOBqeZ5b0u4TPti+Qvg=" Cancel-Lock: sha1:jOgsHcw410hIu6FF/OgKjPZU7OM= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-Priority: 3 X-RFC2646: Format=Flowed; Response X-MSMail-Priority: Normal Xref: news.eternal-september.org comp.lang.ada:66496 List-Id: "Lioneldraghi" wrote in message news:vk4uee$3lfp0$1@dont-email.me... ... > Le 06/09/2024 à 02:03, Randy Brukardt a écrit : >> (3) A number of syntax options are eliminated. Matching identifiers are >> required at the end of subprograms and packages. Initializers are always >> required (<> can be used if default initialization is needed). Keyword >> "variable" is needed to declare variables (we do not want the worst >> option >> to be the easiest to write, as it is in Ada). > > Why are you considering variables worst than constants? > > I don't want the the "worst" option to be the easiest to write, but > neither do I want to put one more keyword in the most common case. A lot of "variables" in code actually are only written once. In Ada, those are better modeled as constants. A constant tells the reader that the value doesn't change during the life of the object, which is easier for analysis (both human and machine). Secondly, I am assuming that automation is helping to write a lot of code. "One more keyword" is irrelevant in terms of creating code, the only question is whether it hurts readability. I prefer to have most things written explicitly (but not to the point of noise, of course). That seems especially true if the code is being written by a program and mostly you are trying to figure out why it doesn't work! > Note that : > 1. I have no statistics, but it seems to me that there is more variables > than constants in my code. But how many of them *have* to be variables vs. the number that just are because it is easier? I know I have a number of the latter. > 2. I say "Useless" from my coder point of view, I dont know if it simplify > the work for compiler or tools implementers. Constants do help the compiler generate better code, although a lot of the benefits can be gained also by working harder. (That's what C compilers do, after all.) Randy.