https://bugs.documentfoundation.org/show_bug.cgi?id=150727

jferard <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
         Resolution|NOTABUG                     |---
             Status|RESOLVED                    |REOPENED

--- Comment #2 from jferard <[email protected]> ---
I disagree. Passing arguments by reference is usual in programming languages
(Java, Python, ...), at least for non primitive types. But this behavior is
very specific and in my opinion a bug.

> when the called subroutine modifies an argument, the caller sees the change.

This is not a modification, this is a *new assignment*. This is a modification
:

```
Sub Main()
        Dim x() As Integer
        x = Array(1, 2, 3)
        Aux(x)
        MsgBox x(0) ' ==> 10 as expected, because the array is passed by
reference
End Sub

Sub Aux(y As Variant)
        y(0) = 10 ' modification of the array referenced by both x and y.
End Sub
```

> It's by design in Basic (and in VBA as well).

Not in Visual Basic .NET (.NET Core):
https://tio.run/##VY/NDoIwEITP9CkmXEoPmqhnTPy7yYlEzy2spgm2poApT49FguicZrOT2W9falFYR32f2bKtCJf9aBjLW4VMapMIFh31Ax67GnnjtLmzyCNFfLM2xiSOZBWSu9YnXuBHYbGWgk3jwZraVrS8Ot3QWRsa4hxpugUPhRyyBvknFQ2V7GRKBI4RZqjuZggx16twuBuIlHR/RBvxrQA@dvyu798

Please check in VBA (really), I can't but I'm pretty sure that the output will
be "foo" and not "bar".

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to