Re:Chromium: Improve support for Nintendo Switch gamepads
by jcelerier on Thursday March 14, 2019 @08:54AM
(#19388750)
six characters to type vs 1 ?
[ Parent
| on HN ]
Re:Chromium: Improve support for Nintendo Switch gamepads
by joshvm on Thursday March 14, 2019 @10:49AM
(#19389687)
You can argue that either way.
Seeing 'this' unambiguously implies instance variable. Otherwise you have to spot the underscore and be aware of the conventions in the codebase. A good IDE should highlight class variables vs locals, though.
On the other hand code can get really messy with boilerplate like this everywhere, and I personally agree with you. Although I believe Google also promotes human-readable variables over less typing.
Re:Chromium: Improve support for Nintendo Switch gamepads
by tokyodude on Thursday March 14, 2019 @01:08PM
(#19391210)
I actually think implicit "this" is a language wart. I think C++, C#, Java, Swift, etc.. would all be better languages if they required `this`. As it is, nearly every one of them ends up needing a per team naming convention to help make the code readable.
int area(int width) {
return width * height;
}
What is "height". Is it a global variable? variable in some outer scope? A member/property of the current object? Absolutely no idea.