Re: Open Source
- Posted by CChris <christian.cuvier at ?gr?culture.gouv.fr> Oct 19, 2007
- 610 views
don cole wrote: > > Now that Euphoria open source. (The answer to everything.) How come we now > can't have a Goto? > > Don Cole There has been sustained opposition to it in the past, on the premise that it promotes unmaintainable code. My take on this s that either: 1/ If there were more control flow structures, like exif (exit current if statement), next (evaluate next loop conditional clause), retry (reatsrt at top of loop, skip conditional clause), and if all those, as well as exit, could have an optional parameter, either a relative integer or a label string (to exit nested blocks), then goto wouldn't be needed. That would be my preference. 2/ Some will object the extra keywords. Another possibility is to have a managed goto: goto statements will need a label, so that come_from() will return which label was jumped from last, and come_back() would return to statement following last taken goto. This scheme is exposed in gretar details in the OpenEu specifications at http://oedoc.free.fr . 3/ Yet another: define a new "with RAD" directive, off by default, that would turn on constructs deemed of use at development stage only, not release stage. goto and assert() would be candidates for such constructs. 4/ And after all, I don't care. If someone can use goto effectively, it should be there; if someone uses it to release poor code, that code will be hardly maintained and will go out of sight in a darwinian way. Note that, if goto is allowed, then there must be some way to deal with a goto made inside a for loop, because of the special scoping rules for loop indexes. goto-ing into a routine should not be allowed. goto-ing into another file's top level code may be useful at times, but has issues of its own. See the goto_far statement in OpenEu specs, and also discussions on the OpenEu list on Topica. CChris