Any chance we can get block level scope for variables?
Currently:
Gets converted to Java Code equivalent to:
I looked it up a few days ago and can't remember the details now, but I think Java may still let the scope "leak" out to the Function Level, but I'd at least like the Dim to occur inside the If.
One thing that took some getting used to was how B4A didn't allow variables named the same as Globals. I think there have even been a few threads here claiming rename bugs that are actually variables or subs named the same as Globals getting their name changed. There is no case sensitivity either and I'd make a global named the same as a local without knowing it and the IDE would change all my names...which is a pain to fix when it happens. It would be really nice to be able to have locals the same name as globals and access the globals with this/me or the class name if duplicates at the local/block level.
Currently:
B4X:
Sub MySub
If False Then
Dim test as Int
End If
End Sub
Gets converted to Java Code equivalent to:
B4X:
Sub MySub
Dim test as Int
If False Then
test = 0
End If
End Sub
I looked it up a few days ago and can't remember the details now, but I think Java may still let the scope "leak" out to the Function Level, but I'd at least like the Dim to occur inside the If.
One thing that took some getting used to was how B4A didn't allow variables named the same as Globals. I think there have even been a few threads here claiming rename bugs that are actually variables or subs named the same as Globals getting their name changed. There is no case sensitivity either and I'd make a global named the same as a local without knowing it and the IDE would change all my names...which is a pain to fix when it happens. It would be really nice to be able to have locals the same name as globals and access the globals with this/me or the class name if duplicates at the local/block level.