shadowing vs explicit naming #2033
amitu
started this conversation in
Ideas & RFCs
Replies: 1 comment 3 replies
-
I'd personally prefer explicit naming. We keep the current behavior and make it consistent across the language (in function body). Reason: It makes it apparent while reading the code where I should be looking for the variable definition. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In 0.4 if a component argument is named
x
and component isfoo
, we usefoo.x
to refer to the component argument, andx
on its own refers to global scope. This is done to avoid shadowing global variables.This makes code more verbose, and we do not do this inside function body, which makes it inconsistent.
Should we pick explicit naming or allow shadowing?
Beta Was this translation helpful? Give feedback.
All reactions