Strict syntax

In Solidity, some constructions that are different in meaning have similar syntax. It decreases code readability, moreover, it spoils the life of developers who work on tools for source code (it applies to the compiler as well). It’s nice to see that work is being done in this direction, too.

“In Solidity, some different in meaning constructions have similar syntax.” Photo by Raka Rachgo on Unsplash

emit keyword will be required when generating events.

As for now, firing an event syntactically doesn’t differ from the function call (and structure creation). This problem is especially evident in the ERC20 standard, where one can find a function and an event with the same “signature”.

keyword will be required when generating events. As for now, firing an event syntactically doesn’t differ from the function call (and structure creation). This problem is especially evident in the ERC20 standard, where one can find a function and an event with the same “signature”. New syntax for constructors:

constructor(<args>) public {…

With the release of the compiler version 0.5.0 it will be the only option — functions with the same name as the contract will be prohibited. This change solves the problem of renaming files. In this case, it appears that the constructor turns into a public function. Thus, it becomes callable by anyone, can be called multiple times or not called at all. This solution seems more reasonable if you remember that the constructor can be either public or internal, can’t have view or pure modifiers, can’t have return values, i.e. is a special entity.

It’s curious that at the same time they have opened the issue with a proposal to allow functions of the same name in 0.6.0.

Changed scoping rules for local variables — from the accepted in Javascript to C99/C++.

That means, for example, that variables must be defined before the first reference and conditionals and loops have their own scope (can access upvalues of course).

As for now that code compiles just fine:

function foo () {x = 1; revert (); uint x; }