you use VAR because you want to get the pointer to the array, instead of copying the whole array to the procedure’s stack.

so the suggestion was that if you want to make sure the array won’t be modified, you use “-” mark.

what about optimizations, they say, that in principle compiler can understand that you did not write to the passed array, and instead of passing it to the procedure by value (by copying the whole array), pass it by reference (by copying only pointer to it).

i disagree, because i believe, it is important to mark your intentions. if you intent to make sure you pass it read-only, you pass it with “-”, if you intent to pass it read-write, you pass it just with VAR. passing with ‘OUT’, when you cannot read it, but can only write to it is not supported in Oberon.


@{Antranig Vartanian ; antranigv@spyurk.am} 01.06.2017, 19:08:27

d6fc51a02909013583bf746d04923301

#oberon #programming #language #design ##


բնօրինակ սփիւռքում(եւ մեկնաբանութիւննե՞ր)