hide You are viewing an archived web page, collected at the request of Ethereum Foundation using Archive-It. This page was captured on 08:43:44 Jun 20, 2021 , and is part of the Community collection. The information on this web page may be out of date. See All versions of this archived page. Loading media information

Feature Updates



  • jwgcarlylejwgcarlyle Member Posts: 29
    Thanks, refactoring for "stack too deep" was getting painful, even in fairly trivial situations. Eg I was having to split a function that looked up and then reported the state of a contract using multiple return values.
  • lisperatilisperati Member Posts: 5
    Awesome! Thanks for fixing my order_statistic_tree code, chriseth!
  • chrisethchriseth Member Posts: 170 ✭✭✭

    Solidity now has basic support for libraries which use CALLCODE when functions are called:


    For this, generated "binaries" need to be linked, i.e. the address of the library on the blockchain has to be provided at compile- or link-time.

    Mix will hopefully include a way to automatically scan the blockchain for the exact same code the library compiles to, so you do not need to know where the library has been deployed to.
  • chrisethchriseth Member Posts: 170 ✭✭✭

    You can now throw exceptions manually and thus revert the current transaction (or at least current call): https://github.com/ethereum/wiki/wiki/Solidity-Tutorial#exceptions
  • chrisethchriseth Member Posts: 170 ✭✭✭
    Version 0.1.3 is released, containing the following changes:
    * `throw` statement.
    * Libraries that contain functions which are called via CALLCODE.
    * Linker stage for compiler to insert other contract's addresses (used for libraries).
    * Compiler option to output runtime part of contracts.
    * Compile-time out of bounds check for access to fixed-size arrays by integer constants.
    * Version string includes libevmasm/libethereum's version (contains the optimizer).
    * Bugfix: Accessors for constant public state variables.
    * Bugfix: Propagate exceptions in clone contracts.
    * Bugfix: Empty single-line comments are now treated properly.
    * Bugfix: Properly check the number of indexed arguments for events.
    * Bugfix: Strings in struct constructors.

    A "reference binary" is available here: https://github.com/ethereum/solidity/releases/download/v0.1.3/soljson-0.1.3.js.gz
  • chrisethchriseth Member Posts: 170 ✭✭✭
    Passing storage references in library calls


    You can now pass storage data in a library call via reference. This allows a library to access and modify the storage of the calling contract.

    In my opinion, this is a major landmark towards efficient and complex data structures, reusable algorithms and a "standard library" on Ethereum.

    Remember that the key benefit of libraries is that you can use them without having to pay for their creation, i.e. you can offload a lot of your code into libraries making your contracts smaller and cheaper to deploy.

    The recommended way to use library functions on your data is as follows (please see the example linked above):
    1. Define a struct type (only the type, not a variable of that type) containing all necessary data inside the library - let us call it StructType here.
    2. Make sure that the first parameter of each library function that wants to access the data is "StructType storage self" - like in Python.
    3. Declare a state variable of that struct type in your contract or even an array or mapping of that struct type (if you need more than one of those objects).
    4. Explicitly supply the storage variable as the first argument to the library function, i.e. your calls to library functions will look like LibraryName.function(data, ...)

    We plan to also automatically attach library functions to struct objects, so that you can directly write "data.function(...)".

    Of course, libraries will only be cheap if the same library code is shared by many contracts. For that, we need you to publish your libraries. If you like, we gladly accept pull-request against https://github.com/ethereum/dapp-bin/tree/master/library .
  • BikuyBikuy Member Posts: 36
    Good stuff guys, keep going strong!

Sign In or Register to comment.