0.0007 s - время 2 - запросов

We use cookies in order to improve your experience while using our website. If you continue to use our site, you accept our Cookies Policy, revised Privacy Policy and updated Terms of Use.

BTC $ 4058.80799892 (1.42 %)
ETH $ 152.384759319 (2.16 %)
XRP $ 0.3661631197 (1.22 %)
BCH $ 161.7056797 (1.73 %)
EOS $ 2.8152620857 (2.37 %)
LTC $ 39.7024239108 (3.88 %)
XLM $ 0.1237873684 (2.56 %)
USDT $ 1.0182375166 (0.33 %)
TRX $ 0.0259286661 (8.33 %)
BSV $ 87.5431633489 (-0.14 %)

Details Of Solidity 0.5.0 Update With Respect To Variables

20:00 27/03/2019
Details On Solidity 0.5.0
share: TELEGRAM FAcebook Twitter REDDIT



Solidity updates can be big or small. Either way, they bring changes both to the existing environment and planned projects. We have already examined some important details on particular updates related to struct components and functions visibility. Still, there are many other interesting questions left.


As it was mentioned in previous articles devoted to Solidity, all Solidity updates may be divided into several categories and relate to different components.


In terms of categories, these changes are:


  • Top language changes;
  • Updates that are crucial for the code;
  • Updates related to language features;
  • Updates related to compiler features;
  • Bug removal.


In terms of components, these changes are associated with:


  • Changes in language semantics and syntax;
  • Explicitness management;
  • Unnecessary component removal;
  • The management of contract interoperability.


In this article, we will talk about changes regarding variables. Since variables are the smallest components of a smart contract, their modification can be attributed to the first three categories and any of types. A more detailed classification is impossible without a specific example.


Changes In Variables Introduction


The first change we are going to talk about concerns the way variables are introduced in a contract. The change statement itself looks like this:


The var keyword is now disallowed to favor explicitness.



So what does it mean? Basically, there are two ways of creating new variables in the programing language. The first way presupposes that there should be a keyword before the variable declaration section. For example, this approach is used in the Pascal language. In order to create new variables, one needs to enter “var” and then specify their list.


The second change presupposes that there is no special declaration word. This means that new variables are introduced in any place of a program. Each unknown word will be automatically checked for syntax and defined by the compiler as a variable, a function, or any other program component.


Let’s compare these two examples:

Changes In Variables Introduction

Previously, it was possible to declare variables in Solidity in both ways. We can see this in the previous language versions. Such a mixed approach can confuse developers, it takes free space in the code and requires additional code processing. Eliminating such redundancy improves the quality of the code.


Change In Storage Variables


The second change is about storage variables. There are several different areas where developers can store variables data. The most crucial one is the contract storage area. It takes place on blockchain. Thus, any possibility of clearing unnecessary memory load is positive.


The change statement is:


Uninitialized storage variables are now disallowed


What does this mean? In general case, it is possible to create a variable without giving a value to it. This means that you reserve the name and space but the variable doesn’t participate in program execution yet. When it comes to temporary memory, it doesn’t matter how much variables exist. But in the case of blockchain memory or contract execution memory, this plays a great role.


Removing the option of variables introduction eliminates unnecessary reservation of empty space.




The above examples of changes in the Solidity language are important ― they are responsible for saving space and increasing clarity. However, such an actively developing language may reverse them in the future. Other interesting changes include tuples management, arrays, and assignment issues. We are going to talk about them in our next articles.

Found a mistake? Highlight it and press Ctrl + Enter to notify the administrator.

Up-to-date Blockchain and cryptocurrency news. Be the first to know!

What is it for?