Let us say I have a class (
Class1). It has a single property (
X). It has one method -
Sub SetX(x As Integer) Self.X = x End Sub
Given this code:
Var c As new Class1 c.X = 10 c.SetX(20)
The value of
c.X after the call to
20 which is what I expect.
My question is, how "safe" is this? The compiler seems able to figure out that I want to use the lowercase variable
x to assign to the instance property
X. I'm assuming that because it is shadowing the instance property and the direct call to
Self.X explains to the compiler my intention. Is this a correct assumption?
Before you all shout at me that this is code smell - I know it is. I am porting a huge Java library (which is case-insensitive) and I'm finding it less error prone to port by preserving the variable names rather than changing them.