On Saturday, April 21, 2018 at 9:30:22 AM UTC-4, b97...@gmail.com wrote: > > var someInterfaceValue interface{} > switch { > case someInterfaceValue: // proposal: compile error: non-bool used as > condition > case someInterfaceValue == true: // OK > } > > Sometimes carefulness is just not enough. > One may type a wrong variable as the case condition, or a incomplete > condition. > Why is this special? Because it's commonly used. >
This proposal is equivalent to forbid the implicit bool "true" left operand. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.