[Gambas-user] Issue 140 in gambas: Optional argument parser not good enough.

gambas at ...2524... gambas at ...2524...
Tue Nov 8 17:05:47 CET 2011


Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any  
Desktop-Any GUI-Any

New issue 140 by emil.len... at ...626...: Optional argument parser not good  
enough.
http://code.google.com/p/gambas/issues/detail?id=140

1) Describe the problem.
The parser that parses optional arguments in function declarations is a bit  
strange.

This is OK:
Public arr As New Integer[2]
Public Sub Func(Optional i As Integer = arr[0])
End

But this is a syntax error according to the parser:
Public arr As New Integer[2, 2]
Public Sub Func(Optional i As Integer = arr[0, 0])
End

This is not ok either:
Public Sub Func(Optional i As Integer = getSomeValue())
End

However, the interpreter seems to be ready to handle that kind of code, so  
it is strange that the parser fails.

(And if it is meant that it should only be possible to pass "simple"  
values, this has already failed because the first valid array syntax can be  
used on any class that has the _get method which also can have side  
effects.)

2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: TRUNK
Revision: r4236





More information about the User mailing list