New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tip for avoiding var #57
Comments
Can someone expand on why? Because 'var's are mutable? |
Good question. Its non-explicit and kind of lazy. The only reason I can think of to use |
Honestly when I saw 'var' I thought JavaScript and lapsed into thinking
about 'const' and 'let'. But solidity just looks like JS, but is very very
different.
So wouldn't it make sense to enforce type declarations? I think I would do
that to get developers that may be alternately writing JS and Solidity to
remember that they're in a very different and unforgiving environment when
writing Solidity.
On Wed, Jul 19, 2017 at 2:26 PM maurelian ***@***.***> wrote:
Good question. Its non-explicit and kind of lazy.
The only reason I can think of to use var, is to avoid having deciding
what kind of type you want to use, which shifts the cognitive load to devs
reading and reviewing your code. Readability is key to security.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#57 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACq8AUNFb_GjrK1dKiTQVoT1TouEMLvSks5sPfYKgaJpZM4JukNH>
.
--
John J. Allen
|
Yeah. The "solidity is like js" meme is a pretty bad one, which this
|
Consolidating this with #78. |
also mentioned in solidity docs
The text was updated successfully, but these errors were encountered: