Closed IngwiePhoenix closed 8 years ago
That's a good bug.
Ideally, oj should do the same thing that Obj-C does and have foo
refer to the parameter and not the ivar within the function scope (although this will cause a warning if -Wshadow
is on).
Pragmatically, such behavior would add complexity to the AST transpiler, and I'm not sure how often this issue would come up when using standard Obj-C conventions (prefixed _ivars).
My gut instinct is: have this be a compiler error for now. Reinvestigate in the future if/when we keep track of additional scope information.
function F(a, b)
can be compiled into a bug IF the currently present scope devines a variable for that.Becomes:
I would believe that it should be valid to use
self.foo = foo
, but I just wanted to report this since it seems to be very unexpected behaviour.