0

As Solidity is keep updating and so the compiler. In the beginning there was constant keyword which now is deprecated. So how does that smart contract is still working? If i make some contract with ^0.4.21 and now the latest is 0.4.24 how it work? I not getting the idea behind the working of smart contract. Any help is much appreciated. Thanks in advance

1

Deprecating a keyword does not mean that it can't be used. It simply means that it may be removed in a future version and it should not be used.

As is the case with all programming languages, Solidity also tries its best to be backwards-compatible. This means that the next version of Solidity will also run code which was created with a previous version of the compiler.

However, as is the case with all programming languages, at some point some features simply can't stay backwards-compatible. At some point in the language development some deprecated feature is possibly truly removed and at that point old code will not work with that version anymore. The point of of marking some features as deprecated is to tell developers that the feature may be removed in the future.

  • Yes, deprecation warnings appear every time someone tries to use the deprecated item, and they stick around long, long before the items are actually removed - if they are removed. So, anybody building code regularly should never be left out of the loop, and each will have plenty of time to get on board with the new changes. – CreatedAMadman Jun 15 '18 at 21:03
0

Solidity is compiled down to EVM bytecode which is what is actually executed on the blockchain by miners.

Changes to the Solidity compiler affect the way that Solidity code is transformed into bytecode, but only new releases of the mainnet (e.g. Metropolis) which introduce new opcodes (but don't remove old opcodes generally) would impact the way that bytecode is interpreted.

So, for example:
function foo() constant {...}
and
function foo() pure {...}
would compile down to the same bytecode - the constant / pure keywords are used by the compiler to check for errors at compile time.

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.