There's a reason that many prettyprinters let you configure the indentation 
rules; feelings are strong and there is no consensus.


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

________________________________________
From: IBM Mainframe Discussion List [[email protected]] on behalf of Bob 
Bridges [[email protected]]
Sent: Friday, June 18, 2021 12:50 PM
To: [email protected]
Subject: Re: EXTERNAL: Coding for the future

I've never written in one of those languages, but while I don't feel that way 
about DO and END -- maybe because they're text, not one-character symbols -- I 
kind of see what you're getting at.  By habit, though, I'd probably write it 
the same way I do it in REXX:

   if (something == 10) {
     run some stuff;
     run more stuff;}

In other words, I'm letting the indentation tell my eyes what I need to know, 
and it's up to me to make sure the indentation accurately reflects the actual 
syntax.

But maybe if I wrote in C for a while I'd come around to your way of thinking.  
I don't want Mr Metz to think me a traitor, but in C style I can feel the force 
of your example.

---
Bob Bridges, [email protected], cell 336 382-7313

/* The reasonable man adapts himself to the world; the unreasonable one 
persists in trying to adapt the world to himself.  Therefore all progress 
depends on the unreasonable man.  -George Bernard Shaw, "Maxims for 
Revolutionists" */

-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of Tom 
Brennan
Sent: Friday, June 18, 2021 12:24

Side track to logic blocks: I like matching up indentations on the do/end 
instead of if/end.  And the same in C-style languages such as:

   if (something == 10)
    {
     run some stuff;
     run more stuff;
    }

But almost all code I see in the world (other than my own) does this:

   if (something == 10) {
     run some stuff;
     run more stuff;
   }

That just confuses me when I need to match up the brackets or do/end's.

--- On 6/18/2021 9:12 AM, Seymour J Metz wrote:
> I agree, although if I expect to be adding code in the future then
> I'll write
>
>     if fx then do
>        ntim=ntim+1
>        end
>     else do
>        nres=nres+1
>        end
>
> Note that I don't like, and don't use in REXX scripts, the C indentation 
> conventions; I indent END.
>
> ________________________________________
> From: Bob Bridges [[email protected]]
> Sent: Friday, June 18, 2021 11:57 AM
>
> Ack!  To my mind
>
>    if fx then
>      do
>        ntim=ntim+1
>      end
>    else
>      do
>        nres=nres+1
>      end
>
> ...is much harder to read than
>
>    if fx then ntim=ntim+1
>          else nres=nres+1
>
> -----Original Message-----
> From: Crawford, Robert C.
> Sent: Wednesday, June 16, 2021 09:23
>
> It's a small thing, but I now longer try to cram as much code into
> line as I can.  Now I put spaces between operators and variables and
> after commas.  I also put the clauses following "THEN" and "ELSE" on another 
> line.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to