[Oberon] Dynamic local array implementation
andreas_pirklbauer at yahoo.com
Sun Oct 15 18:19:03 CEST 2017
> On Sun Oct 15 17:49:13 CEST 2017 Diego Sardina wrote:
> 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.
Yes, a "mutable copy" of a value parameter.
> This is also where an OUT parameter would be very useful.
Of course, one could always do that. But then one would
have *three* types of procedure parameters in the language.
Over the years, various other languages have experimented
with that possibility. For example, we had a fairly elaborate
(and in fact quite similar) debate on that topic in the
Swift programming language as well - originally, Swift also
had *three* types of parameters: value, “var" and “inout”.
(value was clear, but both “var” and “inout" gave a mutable
local copy of a value, but parameters marked inout are
automatically written back). In the end, a decision was
made to eliminate “var” and keep “inout” in the language.
I presume Swift “inout” it is close to what you mean by OUT.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon