<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> On Sun Oct 15 17:49:13 CEST 2017 Diego Sardina wrote:</span></font><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> Note that this can cause aliasing problems, expecially in
> multithreading programs. One has to copy the content of the
> structure parameter in a local variable to make sure that it
> remains constant (and consistent) during the whole processing.</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Yes, a "mutable copy" of a value parameter.</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> This is also where an OUT parameter would be very useful.</span></div><div class=""><br class=""></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">Of course, one could always do that. But then one would</span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">
</span></font></div><div class=""><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">have *three* types of procedure </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">parameters </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">in the language.</span></div><div class=""><br class=""></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">Over the years, various other languages have experimented</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">with that possibility. </span><span style="white-space: pre-wrap; font-family: monospace;" class="">For example, </span><span style="white-space: pre-wrap; font-family: monospace;" class="">we </span><span style="white-space: pre-wrap; font-family: monospace;" class="">had a fairly elaborate</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">(and in fact quite similar) debate </span><span style="white-space: pre-wrap; font-family: monospace;" class="">on that </span><span style="white-space: pre-wrap; font-family: monospace;" class="">topic</span><span style="white-space: pre-wrap; font-family: monospace;" class=""> in the</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Swift programming language as well - o</span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">riginally, Swift </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">also</span></font></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">had </span><span style="white-space: pre-wrap; font-family: monospace;" class="">*three* </span><span style="white-space: pre-wrap; font-family: monospace;" class="">types of parameters: </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">value, “var" and “inout”.</span></font></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">(value was clear, but </span><span style="white-space: pre-wrap; font-family: monospace;" class="">both </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">“var”</span></font> <font face="monospace" class=""><span style="white-space: pre-wrap;" class="">and “inout" gave a mutable</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">local copy of a value, </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">but </span><span style="white-space: pre-wrap; font-family: monospace;" class="">parameters </span><span style="white-space: pre-wrap; font-family: monospace;" class="">marked</span><span style="white-space: pre-wrap; font-family: monospace;" class=""> </span><span style="white-space: pre-wrap; font-family: monospace;" class="">inout are</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">automatically </span><span style="white-space: pre-wrap; font-family: monospace;" class="">written back). </span><span style="white-space: pre-wrap; font-family: monospace;" class="">In the end, a </span><span style="white-space: pre-wrap; font-family: monospace;" class="">decision was</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">made </span><span style="white-space: pre-wrap; font-family: monospace;" class="">to eliminate “var” </span><span style="white-space: pre-wrap; font-family: monospace;" class="">and </span><span style="font-family: monospace; white-space: pre-wrap;" class="">keep “inout” in the language.</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">I presume Swift “inout” it is close to what you mean by OUT.</span></font></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">-AP</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div></div></body></html>