Skip to content

immutable for libraries / dynamic libraries / high-level delegatecall #11695

Open
@chriseth

Description

@chriseth

I'm pretty sure there are issues about this scattered across the project, but this has come up recently, so I'll create a new one.

Since linking is a bit cumbersome, it has been brought up that libraries should be explicit immutable state variables, so that linking happens at construction time instead of before deployment. If we also open this up to non-immutable state variables for libraries, it will create a high-level interface for delegatecall and proxies, even though the library interface cannot be changed after compilation (i.e. for a truly generic proxy, we would need .delegatecall anyway).

Pros:

  • easier recompilation (no issue about using the compiler to link or substituting manually)

Cons:

  • it is more complicated for off-chain tools to get the library address (it is not directly in the metadata file, but has to be extracted from the constructor)
  • "using for" does not work

Metadata

Metadata

Assignees

No one assigned

    Labels

    high impactChanges are very prominent and affect users or the project in a major way.language design :rage4:Any changes to the language, e.g. new featuresmedium effortDefault level of effortmust have eventuallySomething we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.needs designThe proposal is too vague to be implemented right away

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions