On Wed, Jun 12, 2019 at 1:18 AM Jan Mercl <0xj...@gmail.com> wrote: > > Disallowing unintended fall throughs into labeled sections of a block > will prevent a class of stupid errors. > > I'm stupid and I know it. Yet, it seems I haven't made this kind of error > in the last ten years of Go. Maybe I'm just lucky. Or maybe this kind of > error is rare. But if it's rare then a language change preventing it is > questionable as the improvements would be also rare. > > Are there any statistics available about how many times people run into > this class of bugs? >
I've been trying to drag the AST/ksh code (written in C) into the 21st century for the past two years. It contains more goto's and associated labels per 1KLOC than any code base I've worked on in the past four decades. I can recall fixing just one bug of this type (i.e., unintended fallthru to a labeled block) in this project. I can't recall dealing with any other instances in the four decades I've been programming. So my anecdotal experience is that this class of error is exceedingly rare. Note that this class of bugs is distinct from that caused by C's default of case blocks falling thru to the next case block if you don't explicitly break from the block. A feature that does cause lots of bugs. Fortunately the designers of Go broke from C tradition in this regard. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD-bChqXC-%2BEJdV%2BO%3DWwCrRkgBtgbZRFBZvfx5CF7-CTNQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.