From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ichbiah 2022 compiler mode
Date: Sat, 21 Dec 2024 02:14:00 -0600 [thread overview]
Message-ID: <vk5tc9$3uoku$1@dont-email.me> (raw)
In-Reply-To: vk4uee$3lfp0$1@dont-email.me
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1992 bytes --]
"Lioneldraghi" <lionel.draghi@free.fr> 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.
next prev parent reply other threads:[~2024-12-21 8:14 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 11:52 Ichbiah 2022 compiler mode Kevin Chadwick
2024-09-05 13:40 ` Jeffrey R.Carter
2024-09-05 13:49 ` Bill Findlay
2024-09-05 19:22 ` Jeffrey R.Carter
2024-09-05 14:05 ` Kevin Chadwick
2024-09-05 16:08 ` Kevin Chadwick
2024-09-05 19:24 ` Jeffrey R.Carter
2024-09-06 0:03 ` Randy Brukardt
2024-09-06 0:58 ` Lawrence D'Oliveiro
2024-09-12 4:39 ` Randy Brukardt
2024-09-12 22:24 ` Lawrence D'Oliveiro
2024-09-14 6:18 ` Randy Brukardt
2024-09-14 7:18 ` Lawrence D'Oliveiro
2024-09-06 21:22 ` Simon Wright
2024-09-07 17:13 ` Niklas Holsti
2024-09-07 20:34 ` Nioclás Pól Caileán de Ghloucester
2024-09-12 4:46 ` Randy Brukardt
2024-09-12 7:42 ` Niklas Holsti
2024-09-12 9:07 ` Dmitry A. Kazakov
2024-09-12 12:36 ` Kevin Chadwick
2024-09-12 15:43 ` Niklas Holsti
2024-09-13 20:45 ` Nioclás Pól Caileán de Ghloucester
2024-09-12 9:04 ` J-P. Rosen
2024-09-12 11:35 ` Niklas Holsti
2024-09-14 6:13 ` Randy Brukardt
2024-09-14 6:47 ` Dmitry A. Kazakov
2024-09-14 7:19 ` Lawrence D'Oliveiro
2024-09-14 8:12 ` Niklas Holsti
2024-12-20 23:26 ` Lioneldraghi
2024-12-21 8:14 ` Randy Brukardt [this message]
2024-12-21 9:50 ` Jeffrey R.Carter
2024-12-24 1:00 ` Randy Brukardt
2024-12-21 17:19 ` G.B.
2024-12-21 17:35 ` Chris Townley
2024-12-22 12:15 ` Simon Wright
2024-12-22 15:52 ` G.B.
2024-12-22 23:06 ` Simon Wright
2024-12-24 1:03 ` Randy Brukardt
2024-12-21 21:26 ` Keith Thompson
2024-12-22 9:32 ` Pascal Obry
2024-12-21 0:52 ` Lioneldraghi
2024-12-21 8:19 ` Randy Brukardt
2024-09-06 11:07 ` Jeffrey R.Carter
2024-09-06 20:26 ` Nioclás Pól Caileán de Ghloucester
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox