Troy Beckstrom
unread,May 11, 2010, 10:46:19 AM5/11/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
If you're breaking out of so many levels that you have to "count" then
isn't your function too deep? That kind of break should really be a
"return" or "goto error". Everyone's mind seems to have jumped
straight into the gutter with break 3, 4, 5, etc. I guess you're
right, I wouldn't want to encounter some spaghetti code "break 6".
I was really only thinking about break 2. I've run into a lot of
cases where I just needed to break one more level. Typically, it's
where the condition for breaking requires a scanning loop, but then
the break would be caught by the scanning loop itself.
A syntactic sugar "breakbreak" would give an excuse to only provide 2
levels, if you're afraid more than 2 would be used for evil.
(I guess this idea is doomed anyway on the grounds of providing more
than one way of doing something.)