janfl wrote:OpenOffice passes variables by name and not by value.
That's not quite correct. First I want to make clear that I understand "by name" here as "by reference". The same reference can be assigned to more than one name in relevant cases as seems to be common to object oriented programming or even in a wider range. AOO BASIC gives you the choice how a Sub or a Function
treats the passed parameter.
Default is "by reference", but you can use the 'ByVal' clause prefixed to a formal parameter to change that. If you do, the routine (Sub or Function) will create a local variable accessed with the name of the formal parameter and containing the de-referenced data. In case of a call from a formula in Calc, e.g, this is (mostly) already done by the evaluator.
However, if already the actual parameter passed when
calling the routine is a
name or an expression for a refernce ('Pointer'), the corresponding formal 'ByVal' parameter will, though created locally, again only contain the pointer (reference), not the data. In fact the routine (or the parts of the system helping it run) would need to know and to use a lot of additional information to be able to de-reference the data. I cannot imagine a system that actually does so, except in very specialized cases where the structure of the passed "thing" is either known to the routine anyway, or allows for a very simple description that can be passed in addition, as may be the case for arrays of simple scalar values. Standard seems to be to pass "dynamic arrays" as just 1D data + 'High' info, and leave the rest to the routine.
(Not being a programming expert, I hope nonetheless this makes sense.)
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München