5 ms·
I'm not using the formal definition here -- I meant that there are programs you can write in other mainstream programming languages that just can't be expressed
by giaour 3y ago
I'm not using the formal definition here -- I meant that there are programs you can write in other mainstream programming languages that just can't be expressed in COBOL due to limitations on recursion.
The COBOL spec doesn't allow recursive "paragraphs" (functions), though some implementations support it. (This may no longer be the case, or this limitation may have been specific to the language version used at my job.)
The main limitation is I/O, though. You typically use JCL to indicate what files/DBs a program will run against, and I recall that everything that touched the network was written in Java and called from JCL (whether this was because networking libraries don't exist in COBOl or because those that do are terrible, I couldn't say).
- paulddraper 3y agoRecursion is not necessary for Turning completeness. Recursion and loops are interchangeable.
- araes 3y agoIt was somewhat dependent on your job, although the norm is no recursion. From Wikipedia "other compilers, like IBM COBOL, will produce code that prints "1 2 3 END END END END ..." and so on, printing "END" over and over in an endless loop." [1] Also, having never used COBOL, the PERFORM statement is pretty cool. Like calling arbitrary parts of a Switch statement with a single line. Would be neat if some other languages had that. [1] https://en.wikipedia.org/wiki/COBOL#Procedures https://en.wikipedia.org/wiki/COBOL#Procedures
- MarcusE1W 3y agoYou can use recursion in COBOL, you just have to write your own stack first. But I agree, it’s definitely more limited than other languages.