Can't this whole concept be considered foolish as if there were 20-30 files (as many update programs have) then the programmer would have to use a different mental syntax. That would imply that the real code starts around column 140. ----- Original Message ----- From: "Ken Wallis" <[EMAIL PROTECTED]> To: <u2-users@listserver.u2ug.org> Sent: Thursday, April 14, 2005 11:51 PM Subject: RE: [U2] Multiple OPEN statements
> Mark Johnson wrote: > > > I just acquired a new client and found an interesting > > programming style that > > for the life of me I cannot understand why anyone in their > > right mind would do such a thing. > > > > Not on all programs but it seems that for programs that open > > less than 4-5 > > files, the programmer continues the logic in the THEN section > > of the open statement. Example: > > > > OPEN FILE1 TO F.FILE1 THEN > > OPEN FILE2 TO F.FILE2 THEN > > OPEN FILE3 TO F.FILE3 THEN > > EOF=0 > > LOOP READNEXT ID ELSE EOF=1 UNTIL EOF DO > > PROCESS, PROCESS, PROCESS > > REPEAT > > END ELSE PRINT "CAN'T OPEN FILE3" > > END ELSE PRINT "CAN'T OPEN FILE2" > > END ELSE PRINT "CAN'T OPEN FILE1" > > END > > Yes Mark, this is a new fangled thing that I believe is called 'Structured > Programming'. I suspect it'll never catch on, obviously it's only just > reaching your part of the world. ;^) > > > There could be 200-300 lines between the OPEN for FILE3 and > > its error message. > > Well, that part I don't like, but shit happens I suppose. A bit like: > > OPEN FILE1 TO F.FILE1 ELSE GOTO 999 > > where 999 is a long way away. > > Personally, I'd code the above example as: > > OPEN FILE1 TO F.FILE1 THEN > OPEN FILE2 TO F.FILE2 THEN > OPEN FILE3 TO F.FILE3 THEN > GOSUB PROCESS_STUFF > END ELSE PRINT "CAN'T OPEN FILE3" > END ELSE PRINT "CAN'T OPEN FILE2" > END ELSE PRINT "CAN'T OPEN FILE1" > > STOP > > PROCESS_STUFF: > EOF=0 > LOOP READNEXT ID ELSE EOF=1 UNTIL EOF DO > PROCESS, PROCESS, PROCESS > REPEAT > RETURN > > END > > or even as: > > GOSUB OPEN_FILES > IF SHIT_HAPPENED ELSE > GOSUB PROCESS_STUFF > END > STOP > > OPEN_FILES: > SHIT_HAPPENED = "" > OPEN FILE1 TO F.FILE1 THEN > OPEN FILE2 TO F.FILE2 THEN > OPEN FILE3 TO F.FILE3 ELSE > SHIT_HAPPENED = FILE3 > END > END ELSE > SHIT_HAPPENED = FILE2 > END > END ELSE > SHIT_HAPPENED = FILE1 > END > IF SHIT_HAPPENED THEN > PRINT "Can't open ":SHIT_HAPPENED > END > RETURN > > PROCESS_STUFF: > EOF=0 > LOOP READNEXT ID ELSE EOF=1 UNTIL EOF DO > PROCESS, PROCESS, PROCESS > REPEAT > RETURN > END > > > Now I know that Pick is pretty loose and forgiving. But what > > could be the sanity behind this. > > You know the funny thing is that programmers who use decent editors don't > seem > to find the whole indentation thing so challenging. ;^) > > Cheers, > > Ken > ------- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/