On Gotos and the long thread - some thoughts
- Posted by christian.cuvier at education.gouv.fr Aug 26, 2002
- 413 views
C'est un message de format MIME en plusieurs parties. ------=_NextPart_000_0152_01C24D31.A9A38F40 charset="iso-8859-1" Hi everyone ! I'm afraid some of us might miss the main issue while talking about = the dreaded Goto. (*) Since Euphoria's interpreter is not open source, the community = does not have the final word on the features that will be added. RDS = has. So, IMO, the issue is not: "Should goto be added?". The community is = divided on this, as the length of the thread shows. It is:"Will RDS (be = persuaded to) add goto to Euphoria?". The only thing the bickering suggests is a "Wait and see" attitude. = The sad-looking statement on the future of "continue" shows it quite = neatly, I think. (*) is not completely true, since one can always buy the source and = produce one's own interpreter. This is likely to require a high-volume = investment in time for understanding the source, properly modifying it = and insufficiently testing it (never forget tha Murphy was an optimist). = And the issues of portability, compatibility, licensing etc etc start = coming up. My personal stance on *goto*: it isn't either good or bad. Coding is = good or bad, the evauating criteria being readibility and = maintainability of source. I coded quite a few things in Basic and never = needed goto, so it wouldn't bother me. On structured programming. May I attempt to give a definition? A project is a sequence of statements that are expected to perform = several things (the functional specs). The more a coding scheme can be = matched again these specs, the more structured it is. A language is said = to be structured if it encourages and allows structured coding. So, you can code in a structured way even in assembly language. But = the "encourages" criterium is not met, so we generally consider it as an = unstructured language. Pascal, for instance, is so rigid that you are forced to code in a = structured way. But sometimes the structure is not the one you need. C = and Euphoria seem to stand somehow in an acceptable compromise. Goto and structured coding. True, Kat, any flow control instruction is a goto somehow, so all of = them can be replaced by a goto on a lexical standpoint. But not on a = semantical standpoint. Consider the two following cases, lexically equivalent: A: According to the result of some test, one of two or more program = blocks are to be executed. They just reflect an alternative, and are = equivalent in programmer's mind. The if/then/else.. construct (or = select/case) tranlates quite correctly the flow picture the programmer = has in mind while coding. B: In a special case, identified by the result of some test, things get = out of the general case frame, which the main program block is about. = Then, some form of *goto* (goto,exit,resume,whatever...) reflects more = closely the picture in programmer's mind, even though he may have to use = the if/then/else construct for the interpreter/compiler to output an = executable that performs as expected. So, the absence or presence of gotos is not even a sign of = structuredness. A good language would allow a programmer to speak his = mind freely while being understandable by an interpreter/compiler in the = appropriate way, and by other programmers who will follow on the = project. This looks like an utopia; and one may go some steps forward or = backward in this direction. Euphoria has a more intuitive treatment of = sequence (forward), but a limited treatment of loops and branching = (backward). Have a nice day! CChris (don't want to steal Bensler's signature - apologies) ------=_NextPart_000_0152_01C24D31.A9A38F40 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4616.200" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2> Hi everyone = !</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> I'm afraid some of = us might miss=20 the main issue while talking about the dreaded Goto.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> (*) Since Euphoria's = interpreter is not open source, the community does not have the = final word=20 on the features that will be added. RDS has.</FONT></DIV> <DIV><FONT face=3DArial size=3D2> So, IMO, the = issue is not:=20 "Should goto be added?". The community is divided on this, as the length = of the=20 thread shows. It is:"Will RDS (be persuaded to) add goto to=20 Euphoria?".</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> The only thing the = bickering=20 suggests is a "Wait and see" attitude. The sad-looking statement on the = future=20 of "continue" shows it quite neatly, I think.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> (*) is not = completely true,=20 since one can always buy the source and produce one's own interpreter. = This is=20 likely to require a high-volume investment in time for understanding the = source,=20 properly modifying it and insufficiently testing it (never forget tha = Murphy was=20 an optimist). And the issues of portability, compatibility, licensing = etc etc=20 start coming up.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> My personal stance = on *goto*: it=20 isn't either good or bad. Coding is good or bad, the evauating criteria = being=20 readibility and maintainability of source. I coded quite a few things in = Basic=20 and never needed goto, so it wouldn't bother me.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> On structured=20 programming.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> May I attempt to = give a=20 definition?</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> A project is a = sequence of=20 statements that are expected to perform several things (the functional = specs).=20 The more a coding scheme can be matched again these specs, the more = structured=20 it is. A language is said to be structured if it encourages and allows=20 structured coding.</FONT></DIV> <DIV><FONT face=3DArial size=3D2> So, you can code in = a structured=20 way even in assembly language. But the "encourages" criterium is not = met, so we=20 generally consider it as an unstructured language.</FONT></DIV> <DIV><FONT face=3DArial size=3D2> Pascal, for = instance, is so=20 rigid that you are forced to code in a structured way. But sometimes the = structure is not the one you need. C and Euphoria seem to stand = somehow in=20 an acceptable compromise.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> Goto and structured=20 coding.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> True, Kat, any flow = control=20 instruction is a goto somehow, so all of them can be replaced by a goto = on a=20 lexical standpoint. But not on a semantical standpoint.</FONT></DIV> <DIV><FONT face=3DArial size=3D2> Consider the two = following=20 cases, lexically equivalent:</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>A: According to the result of some = test, one of two=20 or more program blocks are to be executed. They just reflect an = alternative, and=20 are equivalent in programmer's mind. The if/then/else.. construct (or=20 select/case) tranlates quite correctly the flow picture the programmer = has in=20 mind while coding.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>B: In a special case, identified by the = result of=20 some test, things get out of the general case frame, which the main = program=20 block is about. Then, some form of *goto* (goto,exit,resume,whatever...) = reflects more closely the picture in programmer's mind, even though he = may have=20 to use the if/then/else construct for the interpreter/compiler to output = an=20 executable that performs as expected.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> So, the absence or = presence of=20 gotos is not even a sign of structuredness. A good language would allow = a=20 programmer to speak his mind freely while being understandable by an=20 interpreter/compiler in the appropriate way, and by other programmers = who will=20 follow on the project. This looks like an utopia; and one may go some = steps=20 forward or backward in this direction. Euphoria has a more intuitive = treatment=20 of sequence (forward), but a limited treatment of loops and branching=20 (backward).</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> Have a nice = day!</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> CChris (don't want = to steal=20 Bensler's signature - apologies)</FONT></DIV> ------=_NextPart_000_0152_01C24D31.A9A38F40--