Mixed visibility (Lesson 9: Hardhat Smart Contract Lottery) #183
-
Hi can someone please help me to understand the reason for the mixed visibility on s_players thanks in advance :) :) :) (from state variables Raffle.sol line 46) (from function getPlayer Raffle.sol line 190 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hi! not only that one.
|
Beta Was this translation helpful? Give feedback.
-
Summary
More information
Giving engineers a visual signal of "oh, this is a storage variable, maybe I shouldn't read and write to it a lot" has proved helpful.
...and it reveals internal implementation details about the contract that a developer shouldn't need to know about. For example, an aggregator would call it This has the added benefit of enforcing that we write natspec docs for all public getters. |
Beta Was this translation helpful? Give feedback.
Summary
getPlayer(0)
is much nicer thans_players[0]
.More information
Giving engineers a visual signal of "oh, this is a storage variable, maybe I shouldn't read and write to it a lot" has proved helpful.
getPlayer(0)
is much nicer thans_players[0]
...and it reveals internal implementation details about the contract that a develo…