It's not a mistake to ban goto... it's not a mistake to keep it...
Posted Feb 10, 2008 7:53 UTC (Sun) by
khim (subscriber, #9252)
In reply to:
More than one way to do it... by im14u2c
Parent article:
Interview: Mark "Markey" Kretschmann (Not the Gentoo Weekly News)
If there are two (or more) ways to do something (like for and while cycles in your samples) but they are used often in real programs - it's not a big deal: reader will remember both and it's easy to understood both. The constructs usable once per a blue moon must be rejected unless they are doing something which will be impossible or very-very hard to do otherwise.
Now about goto: while it's not very useful it's still quite simple to understand because we have "goto in disguise": return. But of course plain old goto is so rare that ban makes sense. But any choice must be justified from reader's position, not from writer's one. This is not how perl chooses the constructs...
(
Log in to post comments)