Meta-programming โ
The functions described here are used to construct a smart contract. Smart contracts are executed once they are deployed in the Tezos blockchain (although they can be simulated). This is indeed meta-programming: we can write a program that writes a program, i.e., constructs a contract.
Note that in the example self.data.xย +ย 2
, the actual addition isn't carried out until the contract has been deployed and the entrypoint is called.