Apache OpenOffice (AOO) Bugzilla – Issue 68059
Basic Option Compatible + opt args bug
Last modified: 2017-05-20 11:27:32 UTC
Options Compatible + Optional Arguments still don't work properly. (1) ParamArray is Still not supported (2) IsMissing gets confused if there arePositional Args past the one being tested - see attached code fragment. Calls 4 and 5 should give the same answer. Note that the Compiler barfs at the Function Definition (B=4 clause) if the option isn't set and CompatibilityMode(True) <or ... False> have no effect, which seems the intended functionality. //Terry Option Compatible Sub Main CompatibilityMode(True) x = AA() 'OK returns 11 x = AA(1) 'OK returns 9 x = AA(A:=1) 'OK returns 9 x = AA(,1) 'OK returns 5 x = AA(B:=1) 'WRONG IsMissing(a) doesn't work. Returns 2 x = AA(2,1) 'OK returns 4 x = AA(B:=1, A:=2) 'OK returns 4 End Sub Private Function AA(Optional ByVal A, Optional B=4) If isMissing(a) Then a = 3 EndIf AA = a+2*b End Function
jsc -> ab: can you please verify this issue
Correct, but rather exotic -> STARTED, P4, OOo Later ab->terrye: Please submit another issue for the ParamArray problem with an example what's not working. I think it is working. At least the following sample in a m177 behaves exactly like VB: option compatible Sub Main() Call test(1, 2, 3) End Sub Sub test(a, ParamArray aArr()) MsgBox a MsgBox aArr(0) MsgBox aArr(1) End Sub
Actually the ability to drop earlier parameters is something that people do do with VBA so it isn't THAT exotic. People will trip over it when they migrate code. If the RTS just barfed then at least it would produce an understandable failure, but it doesn't -- it gives the wrong answer. This one will get some poor VBA migrator cursing because it will be extremely difficult to track down in migration testing. My feeling is we could live with it IF we maintained a central incompatability and know features list that was referenceable from the main OpenOffice site. I will look at my test case for the ParamArray and get back to you with an apology / post a separate issue with test case if necessary. As part of my VBA / OOo Basic comparison I came up with some other anomolies / bugs / features by design. What's the best way to proceed with these? post them as individual issues or send you a discussion paper for first triage and then post the ones that merit tracking as separate issues?
Andreas, ignore the comment about ParamArray -- I didn't have Option Compatible enabled. The following gives the same answer for both VBA and OOoBasic if it is enabled: Sub Main MsgBox a(1, 2, 3, 4, 5) End Sub Function a(ParamArray x()) b = 0 For i = LBound(x()) To UBound(x()) b = b + x(i) Next i a = b End Function
Reset assigne to the default "issues@openoffice.apache.org".