If you don't care about maintainable code than should is to strong. If you care 
about maintainable code then should is too weak.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Robin Vowels <robi...@dodo.com.au>
Sent: Friday, September 4, 2020 6:13 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Constant Identifiers

On 2020-09-05 05:03, Paul Gilmartin wrote:
> On Fri, 4 Sep 2020 17:10:36 +0000, Farley, Peter x23353 wrote:
>
>> Sounds to me like the documentation writer was a bit confused.  Looks
>> to me like it should read instead:
>>
>> If th nnumber 3.1416 is used in more than one place in the program,
>> then you *should* declare it as a named constant.

No. "Even "should" is too strong.

As I wrote earlier. "may" should have been used.

>> If it requires specific data or precision attributes at different
>> places in the program, then you *must* declare it as a named constant.
>>
> Yes.  The first sentence discusses style and belongs in a Programmers
> Guide.
> It should just be removed from a Language Reference.
>
> I haven't Enterprise PL/I.  Can anyone supply a compiled
> counterexample,
> perhaps:
>         area = (radius**2) * 3.1416;
>         volume = (radius**3) * 4/3 * 3.1416;
> ...?  I'll submit an RCF.

As for writing formulas, I prefer to follow a well-known formula, thus:

volume = 4/3 * 3.14159 * radius**3

However, if I'm interested in efficiency, I'd prefer

volume = 4 * 3.14159E0 / 3 * radius**3

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to