-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Closed as not planned
Labels
Description
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:
- uint256
enum MyEnum { A, B, C };
// (...)
MyEnum b = MyEnum.B;
switch(uint(b)){
default:
emit MyEvent();
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.