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...@gmail.com: 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


------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to