billwolf@hubcap.clemson.edu (William Thomas Wolfe,2847,) (12/05/88)
From article <10322@umn-cs.CS.UMN.EDU>, by stachour@umn-cs.CS.UMN.EDU (Paul Stachour): > I'm for reference semantics. They are natural, efficient, and > don't force this explicit-pointer "junk". But let's make sure > what we can do with them in today's environment before we ask > Ada 9X to mandate them. OK, we're sold on the benefits of reference semantics. Let's assume that "in out" parameters are always passed by reference. Now why should it be impossible for the programmer to choose pass-by-value, as in "in" and "out" modes? (BTW, a good compiler could eliminate the copy in many cases by proving to itself that there is no attempt to modify the "in" parameter and therefore just passing it by reference anyway. Such compiler analysis is necessary because programmers frequently want to use "in" mode just to assure the procedure's users that the parameter will not be modified. But sometimes the local copy is modified, and the copy then becomes something that would have had to be done anyway. To force an explicit copy would then reduce program readability.)
stachour@umn-cs.CS.UMN.EDU (Paul Stachour) (12/06/88)
In article <3739@hubcap.UUCP> billwolf@hubcap.clemson.edu writes: >From article <10322@umn-cs.CS.UMN.EDU>, by stachour@umn-cs.CS.UMN.EDU (Paul Stachour): >> I'm for reference semantics. ... > > OK, we're sold on the benefits of reference semantics. Let's assume > that "in out" parameters are always passed by reference. Now why > should it be impossible for the programmer to choose pass-by-value, > as in "in" and "out" modes? Guess I was not explicit enough. Yes, if a programmer specifies only "in" (no writing) or "out" (no reading), there is no need to force reference (values are consistant throughout the "world") sematics. But I don't equate "no writing" with "pass-by-copy-in" or "no reading" with pass-by-copy-out (though, surely, that is one reasonable way to implement it). It's hard not to confuse the desired semantics (always having the correct, current, value) with the mechansims (pass-by-reference); I apologize if my meaning was not clear. ...Paul