For Programmers: Free Programming Magazines  


Home > Archive > Cobol > May 2006 > "Side effects" (Functions, Programs, Object/Methods









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author "Side effects" (Functions, Programs, Object/Methods
William M. Klein

2006-05-23, 6:55 pm

(As a follow-up to another thread)

During the development of the '02 Standard, there was a LOT of discussion about
"side-effects" and what to do or not to do about them.

At one time, it was suggested that neither Functions nor Object/Methods could:

- Have the EXTERNAL phrase within them
- Have POINTER data passed to them (or structures with POINTERS)

And additional discussion occurred on what else could be done to "guarantee"
that functions (unlike programs) and object/methods would NOT have "hidden
side-effects".

I haven't checked in detail, but my MEMORY is that the final decision was that
this was a "good programming style" issue and NOT something that the Standard
could (or according to some SHOULD) get into. Therefore, these restrictions
were not introduced. Whether or not an (informational) note - or something in
the concepts ever documented this "good programming technique" is something I
don't remember, but I don't think so.

NOTE:
There actually was (is?) some question about whether the RANDOM Intrinsic
function does or does not have "side-effects". It certainly REQUIRES that
"information" be maintained between references, but that (to some/many) is
different from "side-effects".

--
Bill Klein
wmklein <at> ix.netcom.com


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com