Alex Puig
Alex Puig
Aug 28, 2018 · 2 min read

Thanks to Christian Reitwiessner. This is a summary of his last talk. Among many changes made, some warnings became errors in this new version. More changes focusing in safety. Main changes are :

  • Explicit visibility : Visibility must be specified, it was a warning, now is an error

function withdraw() public {…}

  • Constructor syntax : Constructor can’t be the name anymore:

constructor() public {….}

  • Emit is now needed for events

emit Withdrawn();

  • Explicit types. Now var is disallowed and you need to specify the type

0.4 → for (var i=0; i<length; i++)

0.5 → for (uint i=0; i<length; i++)

  • Data Location. To specify a data location is function sum(uint[] a);

0.5 → function sum(uint[] memory a);

  • Storage Pointers have to be initialized and assigned

0.4 → Data p; // valid in 0.4 by default it points to storage

0.5 → participants.length += 1

Data storage p = participants[participants.length-1]; // in 0.5

  • Function-scoped variables. Solidity now uses regular scope blocks like c++, not like JavaScript anymore. Only exception being made in the for loop. It allows now to define a variable inside of a scope, which will be freed at the end of the scope, allowing us to pass the limitation of 16 variables per function.

0.4 → i=3;

if (false) { uint i;} // This will not work anymore

0.5 → for (uint i = 0…) // This works and you can declare it many times.

  • Functionality Improvements

a.pop(); // for storage arrays

abi.encode(…)

abi.encodePacked(…)

enums and strcts in interfaces

Caelum Labs

Blockchain adventures

Alex Puig

Written by

Alex Puig

Let's code something interesting #ethereum #blockchain #bigchaindb

Caelum Labs

Blockchain adventures

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade