
Description
1. Sections of code which does not compile:
-
Internal function calls
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#internal-function-calls -
External function calls
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#external-function-calls -
Crating contracts via
new
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#creating-contracts-via-new
A: Keywordnew
is not supported in Array -
Destructuring ssignments and returning multiple values
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#destructuring-assignments-and-returning-multiple-values
-Scoping and Declarations: second set of code
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#scoping-and-declarations
A: most likely because baz
is not implicitly initialized as zero.
- Scoping starting from version 0.5.0
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#scoping-starting-from-version-050
A: we don't support pragma 0.5.0
2. Questions:
-
Do we support
.value()
?
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#creating-contracts-via-new -
In Complications for Arrays and Structs:
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#complications-for-arrays-and-structs
...assigning to a local variable creates an independent copy only for elementary types, i.e. static types that fit into 32 bytes
- is this correct?
A second assignment to the local variable does not modify the state but only changes the reference. Assignments to members (or elements) of the local variable do change the state.
- is this correct?
- Error handling assert require revert and exceptions
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#error-handling-assert-require-revert-and-exceptions
Internally, Solidity performs a revert operation (instruction 0xfd) for a require-style exception and executes an invalid operation (instruction 0xfe) to throw an assert-style exception. In both cases, this causes the EVM to revert all changes made to the state. The reason for reverting is that there is no safe way to continue execution, because an expected effect did not occur. Because we want to retain the atomicity of transactions, the safest thing to do is to revert all changes and make the whole transaction (or at least call) without effect. Note that assert-style exceptions consume all gas available to the call, while require-style exceptions will not consume any gas starting from the Metropolis release.
- is this correct?
3. Errors:
a) Scoping and Declarations: second set of code
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#scoping-and-declarations
contract C {
function foo() public pure returns (uint) {
// baz is implicitly initialized as 0
uint bar = 5;
if (true) {
bar += baz;
} else {
uint baz = 10;// never executes
}
return bar;// returns 5
}
}
A: ERROR: IfStatement_id(17): cannot get oparg1
b) Error handling assert require revert and exceptions
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#error-handling-assert-require-revert-and-exceptions
The throw keyword can also be used as an alternative to revert().
A: Throw doesn't work but it's depricated ERROR: Block_id(11): unknown "Throw
assert
and require
do work, but this.balance
is not supported