You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? No.
A clear and concise description of what the problem is.
Many other languages have a feature where a function name is aliased to the variable 'RESULT'. This variable is a stand-in alias for the function name. It has the same type as the function and can be used instead of - or in addition to - the function's name as the target of an expression. It can also be used in place of the function's name so that it is clear - especially when the function has no arguments - that the function's result is being used in an expression, and it is not a recursive function call.
As people might use result for other purposes, the pseudo variable _Result could be used.
Describe the solution you'd like
IN some program there is
Dim Table$(100)
.
.
Now, is the following legal?
DefInt C
Function Check (X As String)
For Check = 1 to 100
if X=Table$(Check) then exit function
next
check=0
End function
' The function returns where X was found
This could be used instead:
DEFINT C
integer Function Check(X as string)
' In this case an implicit
'' DIM _Result as Integer
''is inside the function
For _Result = 1 to 100
if X=Table$(_Result) then exit function
next
_result=0 '(or)
Check=0
' Both do the same thing.
End function
Function xx$
result = " "
result = result + Table$(Check("Hello"))
exu
Of course these are contrived examples, but I think having either a variable called _Result (or Result) as a variable implicitly defined as local to that function that is an alias for the function's name would be a useful improvement to the language.
Is your feature request related to a problem? No.
A clear and concise description of what the problem is.
Many other languages have a feature where a function name is aliased to the variable 'RESULT'. This variable is a stand-in alias for the function name. It has the same type as the function and can be used instead of - or in addition to - the function's name as the target of an expression. It can also be used in place of the function's name so that it is clear - especially when the function has no arguments - that the function's result is being used in an expression, and it is not a recursive function call.
As people might use result for other purposes, the pseudo variable _Result could be used.
Describe the solution you'd like
IN some program there is
Dim Table$(100)
.
.
Now, is the following legal?
DefInt C
Function Check (X As String)
For Check = 1 to 100
if X=Table$(Check) then exit function
next
check=0
End function
' The function returns where X was found
This could be used instead:
DEFINT C
integer Function Check(X as string)
' In this case an implicit
'' DIM _Result as Integer
''is inside the function
For _Result = 1 to 100
if X=Table$(_Result) then exit function
next
_result=0 '(or)
Check=0
' Both do the same thing.
End function
Function xx$
result = " "
result = result + Table$(Check("Hello"))
exu
Of course these are contrived examples, but I think having either a variable called _Result (or Result) as a variable implicitly defined as local to that function that is an alias for the function's name would be a useful improvement to the language.
Paul
Paul Robinson [email protected]
"
The text was updated successfully, but these errors were encountered: