ERC-20 name and symbol immutable

Code comments in the ERC-20 implementation of openzeppelin suggest that the variables _symbol and _name should be immutable.

All two of these values are immutable: they can only be set once during construction..

But the variables themselves are not immutable
(i.e. https://github.com/OpenZeppelin/openzeppelin-contracts/blob/160bf1a6ebb67fd53f8c4536b944650044124689/contracts/token/ERC20/ERC20.sol#L42-L53).
Is this intentional, since name and symbol are not supposed to be called by contracts or what is the reason for not using immutable variables here?

1 Like

Hello @Markus

Solidity currently only support "immutable" for value types. strings are not value types.

When the compiler add support for immutable non value type, we will probably change that.

1 Like

Thanks that makes sense.
For others: This is the duplicate issue on github.