Is is safe to use pragma experimental “v0.5.0”; in production ready code As per solidity docs-:

Also try to enable the “0.5.0” safety features as early as possible by adding pragma experimental "v0.5.0"; . Note that in this case, the word experimental does not mean that the safety features are in any way risky, it is just a way to enable some features that are not yet part of the latest version of Solidity due to backwards compatibility.

I am just concerned whether we should use it in production ready code or not?


Given that you test properly your code before to deploy it, and do not need backward compatibility for some reasons, why not? Once bytecoded it is as safe as without it.

We are facing a world where the main solidity compiler does not have any major stable release (i.e. 0.4.25 is the latest stable, we do not have any 1.0.0 version!). This means that if you shall need to reuse your code some months later, it shall probably need some updates in order to use the newer compiler versions at the best. And very probably some of the work you do today in order to cope with that pragma will be useful.

Moreover 0.5.0 is on his way: you can already use not stable versions of the same since some days.

So it is useful to use that pragma since now.

At least we are doing so in production.

Hope this can help!


In addition to the other answer: Sometimes using the latest Solidity release is not enough to get latest features, web3 javascript library also has to support it. In other words, without web3 support those cool new features can't be accessed from Javascript world.

For example, when you enable experimental ABIEncoderV2 you get struct type function parameters in Solidity. However, this got support since web3 1.0.0-beta.36 which is the latest release. Truffle suite still depends on a previous release of web3, which means if you write a contract using those cool new features you won't be to write Javascript tests using Truffle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.