But this new feature seems to be not very easy, mainly because of a parser problem.
Example of the parser syntax problem for STATIC PROPERTIES without index parameter:
There is a syntax ambiguity between one of property result assignment syntaxes inside the get-property body and the set-property calling:
Code: Select all
Type typename
Declare Static Property staticPropertyName () As Integer
Declare Static Property staticPropertyName (Byval i As Integer)
Static As Integer staticVariableName
Dim As Integer dummy
End Type
Dim As Integer typename.staticVariableName = 0
Static Property typename.staticPropertyName () As Integer
Return staticVariableName
'or Property = staticVariableName
'or typename.staticPropertyName = staticVariableName ''ambiguity with below line
End Property
Static Property typename.staticPropertyName (Byval i As Integer)
staticVariableName = i
End Property
Dim As Integer variableName = 1
typename.staticPropertyName = variableName ''ambiguity with above line
Print typename.staticPropertyName
the same expression
'typename.staticPropertyName =' is used for 2 different things.
The similar ambiguity for a static function returning by reference is solved by using
'typename.staticFunctionName =' inside the function body, and a mandatory
'typename.staticFunctionName() =' at outside.
But parentheses cannot be used for a set-property calling.
Should the parser distinguish for the same expression depending on whether it is used inside or outside the property body, or should this expression inside the property body be prohibited ( there would be only 2 left available) ?
Conclusion:
Already, when a non-static get-Property is defined with one index parameter, the
'typename.PropertyName =' syntax can not be used inside the property body to return a value. For such a get-Property, the
'Property =' syntax (in addition to the
'Return' syntax) is only the one allowed.
Therefore, for a static get-Property, the
''typename.PropertyName =' syntax could be also disallowed inside the property body.
In conclusion, the
'typename.PropertyName =' syntax could be disallowed inside the property body when the property is defined with one index parameter or the property is static.
I will update the feature request with this parser problem.