-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Minor syntax and formatting changes #3337
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,7 +128,7 @@ Visibility and Getters | |
Since Solidity knows two kinds of function calls (internal | ||
ones that do not create an actual EVM call (also called | ||
a "message call") and external | ||
ones that do), there are four types of visibilities for | ||
ones that do, there are four types of visibilities for | ||
functions and state variables. | ||
|
||
Functions can be specified as being ``external``, | ||
|
@@ -308,7 +308,7 @@ inheritable properties of contracts and may be overridden by derived contracts. | |
address owner; | ||
|
||
// This contract only defines a modifier but does not use | ||
// it - it will be used in derived contracts. | ||
// it: it will be used in derived contracts. | ||
// The function body is inserted where the special symbol | ||
// "_;" in the definition of a modifier appears. | ||
// This means that if the owner calls this function, the | ||
|
@@ -367,9 +367,9 @@ inheritable properties of contracts and may be overridden by derived contracts. | |
} | ||
|
||
/// This function is protected by a mutex, which means that | ||
/// reentrant calls from within msg.sender.call cannot call f again. | ||
/// The `return 7` statement assigns 7 to the return value but still | ||
/// executes the statement `locked = false` in the modifier. | ||
/// reentrant calls from within "msg.sender.call" cannot call "f" again. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The backticks are used to format code, I think it is good to keep them unless you have a compelling reason. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which is the standard? There are two different styles in this file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I'm sorry, I didn't see that. I would lean slightly towards backticks for code citations (quotes should still be used for anything that is not code). What do you think, @axic? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I applied this throughout this file with the latest commit. |
||
/// The "return 7" statement assigns 7 to the return value but still | ||
/// executes the statement "locked = false" in the modifier. | ||
function f() public noReentrancy returns (uint) { | ||
require(msg.sender.call()); | ||
return 7; | ||
|
@@ -448,7 +448,7 @@ Functions can be declared ``view`` in which case they promise not to modify the | |
The following statements are considered modifying the state: | ||
|
||
#. Writing to state variables. | ||
#. :ref:`Emitting events. <events>`. | ||
#. :ref:`Emitting events <events>`. | ||
#. :ref:`Creating other contracts <creating-contracts>`. | ||
#. Using ``selfdestruct``. | ||
#. Sending Ether via calls. | ||
|
@@ -726,7 +726,7 @@ All non-indexed arguments will be stored in the data part of the log. | |
function deposit(bytes32 _id) public payable { | ||
// Any call to this function (even deeply nested) can | ||
// be detected from the JavaScript API by filtering | ||
// for `Deposit` to be called. | ||
// for "Deposit" to be called. | ||
Deposit(msg.sender, _id, msg.value); | ||
} | ||
} | ||
|
@@ -826,7 +826,7 @@ Details are given in the following example. | |
// Use "is" to derive from another contract. Derived | ||
// contracts can access all non-private members including | ||
// internal functions and state variables. These cannot be | ||
// accessed externally via `this`, though. | ||
// accessed externally via "this", though. | ||
contract mortal is owned { | ||
function kill() { | ||
if (msg.sender == owner) selfdestruct(owner); | ||
|
@@ -1177,7 +1177,7 @@ more advanced example to implement a set). | |
} | ||
|
||
Of course, you do not have to follow this way to use | ||
libraries - they can also be used without defining struct | ||
libraries: they can also be used without defining struct | ||
data types. Functions also work without any storage | ||
reference parameters, and they can have multiple storage reference | ||
parameters and in any position. | ||
|
@@ -1383,6 +1383,6 @@ It is also possible to extend elementary types in that way:: | |
} | ||
|
||
Note that all library calls are actual EVM function calls. This means that | ||
if you pass memory or value types, a copy will be performed, even of the | ||
if you pass ``memory`` or value types, a copy will be performed, even of the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, the term "memory" is not used as the name of something but rather the concept and thus I would not code-format it, same goes for storage below. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted |
||
``self`` variable. The only situation where no copy will be performed | ||
is when storage reference variables are used. | ||
is when ``storage`` reference variables are used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also remove the opening parenthesis above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted. Although nested parentheses aren't great, it's the clearest option here.