Feature Updates

I would like to use this thread to announce new Solidity language features as soon as they arrive in the develop branch of cpp-ethereum. The compiler should be stable and tested at all times, but we can not always prevent bugs from sneaking in. If you encounter anything strange, please do not hesitate and open an issue in github.

Just now, interaction between contracts was added. It is now possible to create contracts from within Solidity. For an example, please see the tutorial.

The type limitations for integer literals were lifted. The type is now determined at the point where something else than integer literals is involved (similar to the way it is in go). For details, please see the tutorial on the wiki.

It is now possible to change the visibility ("public"/"private") of functions and storage variables, a contract can define a "fallback function" and we have events to make logs (the SPV helper mechanism) easier. Details in the tutorial. The reason why we also have "public" for storage variables will be clear soon ;-)

Hi criseth... All this is great, but I am baffled by the PT Events feature- It would be awesome if you expand on the tutorial description to make it more "ELI5"... Is this a feature that's currently usable in go-ethereum+ethereumjs?

If the size is fixed, no SHA is involved. If the size is dynamic, a SHA is performed, but this SHA is the same for all indices so it might soon be optimized away for multiple lookups.Note, however, that by the recent changes in gas costs, SHA is only slightly cheaper than loading from storage and modifying storage is more than 100 times more costly than the SHA, and using a new storage slot is almost 1000 times the cost of a SHA.

Note that the gas used by g is different, depending on the value of x. Solidity does its best to try and find the maximal gas value (here, 20708). For the cases where this cannot be done or if Solidity is not clever enough (for example if the code contains loops), it prints [???].For the "construction" part, the two summands are the gas used for executing the constructor(s) and the code storing fee, respectively. If another function is called internally, its gas cost is added to the actual function, but the costs of externally called functions are not added.

Exceptions: If arrays are accessed out of bounds or externally-called functions fail (e.g. due to out of gas), the current execution is also stopped immediately in a failure state. This has the effect that all changes (to state or balance) are reverted.

As this would be quite problematic for send() or non-typesafe calls like call() or callcode(), these functions do not propagate the failure condition but rather return a boolean indicating whether the call succeeded (true) or not (false).

Eventually, Solidity will also receive a throw keyword to manually cause this failure condition and perhaps also try { } catch { }, although try/catch will have rather limited functionality.

Finally, in-memory arrays are finished. You can now pass memory-arrays as arguments of functions and also return arrays from functions. Please take special care about the subtleties involved in memory and storage reference types (e.g. arrays).