Hi folks, I have a proposal that would allow switch statements to use conditions other than equality for comparing against cases.
It involves adding an alternative syntax for switch that uses the case keyword as a pseudo variable representing the expression in each case statement.
The primary example I use is for checking error classes:
switch(error instanceof case){
case TypeError:
return "It's a type error"
case CustomError:
return "It's a custom error"
}
More information on my git hub repo
Does this sound like a reasonable proposal?