You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switch case is important for code cleanness. It's a common feature in all high level languages.
Motivation
While I undestand there is some complex edge cases to deal with on EVM for this control structure been implemented, it should start as simple as possible.
Specification
First iteration:
uint256
enum MyEnum { A, B, C };
// (...)
MyEnum b = MyEnum.B;
switch(uint(b)){
default:
emitMyEvent();
case uint(MyEnum.A):
//(...)break;
case uint(MyEnum.B):
//(...)break;
}
Second iteration:
enum type;
Third iteration:
custom errors
Fouth iteration:
complex structures
Whatever would cause a complexity or need more discussion to be porperly implemented should be left to a later iteration. In my example I used a default: without break;, if that would be difficult to solve, left it for a later iteration.
Backwards Compatibility
The text was updated successfully, but these errors were encountered:
Abstract
Switch case is important for code cleanness. It's a common feature in all high level languages.
Motivation
While I undestand there is some complex edge cases to deal with on EVM for this control structure been implemented, it should start as simple as possible.
Specification
First iteration:
Second iteration:
Third iteration:
Fouth iteration:
Whatever would cause a complexity or need more discussion to be porperly implemented should be left to a later iteration. In my example I used a
default:
withoutbreak;
, if that would be difficult to solve, left it for a later iteration.Backwards Compatibility
The text was updated successfully, but these errors were encountered: