Re: [fpc-pascal] even linus torvalds prefer pascal over c
On Sat, 2 Dec 2006 20:35:49 +0100 (CET) Daniël Mantione <[EMAIL PROTECTED]> wrote: > Well, this is the very point Torvalds was trying to make in the cited > discussion; he wants to use goto in Linux source code, because he > considers it the right thing to do in certain situations. I just happened to bump into a site on Nassi-Schneiderman diagrams again, which are about the same age as the 'structured programming rage'. I imagine they're not Linus' favorite, as they were designed in a way they can't represent gotos at all! John ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Op Sat, 2 Dec 2006, schreef John Coppens: > On Sat, 2 Dec 2006 19:39:34 +0100 (CET) > Daniël Mantione <[EMAIL PROTECTED]> wrote: > > > However, assembler coded is not portable. A hand optimized Pascal > > based solution with goto statements might be preferable over assembler > > code. For example, in the file rtl/unix/video.pp , the procedure > > update_vcsa uses a goto for speed reasons. > > Yes... I understand that, of course. But my arguments against this are: > > 1) Except the compiler writers, few people know what code is generated >for which source (should they know?). How do I know that a goto is >really translated as a jump? You can compile with -a and check the generated assembler code. >I'm no expert, I did see that in many >cases ifs, cases, whiles etc, are sufficiently 'recoded' by the >compiler such as to make it difficult to garantee that (or know if) >the goto is reached fast enough to matter. Correct. Unless you are aggressively hand optimizing code, always rely on your compiler. > 2) Compiler semantic analysis is evolving (I imagine), so I'd suspect >that optimising is also improving continuously... Of course, and compilers can do really amazing optimizations today, sometimes beating hand-coded assembler code if it wasn't written with care. However, today, anno 2006, it is still not that hard to beat compilers with hand written assembler code. > 3) I also believe that gotos are somewhat like guns. If they're available, >it's more probable that people shoot themselves in the foot (or worse). > > Mind, I don't want to remove gotos. I'm all for free choice. But I'm > still very much a proponent to discourage its use for fledgling > programmers. Well, this is the very point Torvalds was trying to make in the cited discussion; he wants to use goto in Linux source code, because he considers it the right thing to do in certain situations. Daniël Mantione___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
John Coppens wrote: > Mind, I don't want to remove gotos. I'm all for free choice. But I'm > still very much a proponent to discourage its use for fledgling > programmers. Well, in fpc, you have to use a compiler option to be able to use them. A good trade-off IMHO. Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
On Sat, 2 Dec 2006 19:39:34 +0100 (CET) Daniël Mantione <[EMAIL PROTECTED]> wrote: > However, assembler coded is not portable. A hand optimized Pascal > based solution with goto statements might be preferable over assembler > code. For example, in the file rtl/unix/video.pp , the procedure > update_vcsa uses a goto for speed reasons. Yes... I understand that, of course. But my arguments against this are: 1) Except the compiler writers, few people know what code is generated for which source (should they know?). How do I know that a goto is really translated as a jump? I'm no expert, I did see that in many cases ifs, cases, whiles etc, are sufficiently 'recoded' by the compiler such as to make it difficult to garantee that (or know if) the goto is reached fast enough to matter. 2) Compiler semantic analysis is evolving (I imagine), so I'd suspect that optimising is also improving continuously... 3) I also believe that gotos are somewhat like guns. If they're available, it's more probable that people shoot themselves in the foot (or worse). Mind, I don't want to remove gotos. I'm all for free choice. But I'm still very much a proponent to discourage its use for fledgling programmers. John ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Op Sat, 2 Dec 2006, schreef John Coppens: > On Sat, 02 Dec 2006 08:01:04 -0500 > David Mears <[EMAIL PROTECTED]> wrote: > > > From the first pascal program that I wrote in the late 80s to today, > > I've only used Goto once and that was because I was still learning the > > language - it was essentially a repeat loop and I replaced it in later > > versions. > > Same here... > > But, I wonder. With modern optimizing compilers doing almost what they > want with the original source code, I'm quite sure some semantic > optimiser will replace parts of codes by goto's anyway. > So why would it > ever be necessary to worry about optimising the source code with > 'spaghetti' code, as we are shifting the responsability for optimising > execution to the compiler writers anyway? The answer is clearly yes. The reason is simple, a perfect compiler does not exist, you can prove that for each compiler, there exists a better compiler. This is not pure theory, situations where the compiler doesn't make the ideal decision are very common. Of course, if a modern compiler isn't good enough, your code must be extremely speed critical, so assembler code might be the best option (which is full of jumps=goto). However, assembler coded is not portable. A hand optimized Pascal based solution with goto statements might be preferable over assembler code. For example, in the file rtl/unix/video.pp , the procedure update_vcsa uses a goto for speed reasons. There are a few other situations you might run into where a goto can be more practical than a goto-less solution. For example, jumping out of nested loops, or jumping in case of an error condition. It is always possible to avoid goto, but there exist cases where using it can be a good engineering decision. > If fact, if the optimiser is good, spaghetti (goto-)programs and 'nice' > code should generate the same executable anyway, shouldn't they? No. A program which determines if two programs are the same cannot exist, this is an uncomputable problem. Because of this, a compiler cannot transform unoptimized code into the most ideal "spaghetti" form. Actually, FPC makes good use of this knowledge. Unlike most compilers, FPC doesn't convert high level constructions into gotos internally. This gives the code generator more information to decide the right instructions to generate, for example for loops generate different code than while loops, because in the case of the for loops, the compiler knows more about the loop termination criterium. > So, > doesn't it make sense to try and make the source as readable as possible? If the question is wether you should for example use a while loop, or emulate it with a goto, the answer is a loud and clear yes. Only in very seldom situations you want to have more control over what exact code is generated. However, the situations were a goto is sometimes preferred is when avoiding it needs extra variables or statements. In this case, it is mostly a matter of taste wether the goto makes the code more readable. To sum it up: Theoretically nobody needs goto. For each use of goto, it can be replaced with a goto-less construction. For each case where the goto is more efficient, you can write an optimization. And for each situation where a high level construction looks worse than a goto-based construction, one can design a high-level construction that makes the goto obsolete. Practically however, one has to deal with that compilers are not, will not, and cannot be perfect, and in some situations, the goto-less solution feels like a work-around. > (Which is why I use Pascal in the first place - without gotos) Well, no modern language is goto based :) But... Pascal pioneered it, and it is nice to know that all modern languages carry a Pascal legacy in them. Daniël Mantione___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
John Coppens schrieb: On Sat, 02 Dec 2006 08:01:04 -0500 David Mears <[EMAIL PROTECTED]> wrote: From the first pascal program that I wrote in the late 80s to today, I've only used Goto once and that was because I was still learning the language - it was essentially a repeat loop and I replaced it in later versions. Same here... But, I wonder. With modern optimizing compilers doing almost what they want with the original source code, I'm quite sure some semantic optimiser will replace parts of codes by goto's anyway. So why would it ever be necessary to worry about optimising the source code with 'spaghetti' code, as we are shifting the responsability for optimising execution to the compiler writers anyway? If fact, if the optimiser is good, spaghetti (goto-)programs and 'nice' code should generate the same executable anyway, shouldn't they? So, doesn't it make sense to try and make the source as readable as possible? gotos make life for optimizing steps based on data flow information very hard, so using while, repeat etc. makes also life for an optimizer easier. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
On Sat, 02 Dec 2006 08:01:04 -0500 David Mears <[EMAIL PROTECTED]> wrote: > From the first pascal program that I wrote in the late 80s to today, > I've only used Goto once and that was because I was still learning the > language - it was essentially a repeat loop and I replaced it in later > versions. Same here... But, I wonder. With modern optimizing compilers doing almost what they want with the original source code, I'm quite sure some semantic optimiser will replace parts of codes by goto's anyway. So why would it ever be necessary to worry about optimising the source code with 'spaghetti' code, as we are shifting the responsability for optimising execution to the compiler writers anyway? If fact, if the optimiser is good, spaghetti (goto-)programs and 'nice' code should generate the same executable anyway, shouldn't they? So, doesn't it make sense to try and make the source as readable as possible? (Which is why I use Pascal in the first place - without gotos) John ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Am Samstag, 2. Dezember 2006 11:59 schrieb Bisma Jayadi: > > * The statement is wrong, pascal allows you to do wrong things. You > > just need to use some typecasts (specially to pointer). > > We can do wrong things almost on anything. It's just the matter of (1) how > we use it [properly] and (2) how it prevents misuse of itself. In this > discussion, the point (1) refers to the programmers, and point (2) refers > to the language. (3) Userfriendliness of Installer and development environment. > So, when point (1) refers to a world-wide known as good programmer, OS > maker, etc. (no matter what language he actually uses) and point (2) refers > to Pascal, that'd be a good material for promoting Pascal. Is it? > > > * It´s written by someone with a strong dislike for pascal. > > And that's the power of this promoting material. A big pascal hater prefers > pascal to do things right! :D I'm the same opinion. Rainer > -Bee- > > has Bee.ography at: > http://beeography.wordpress.com > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
From the first pascal program that I wrote in the late 80s to today, I've only used Goto once and that was because I was still learning the language - it was essentially a repeat loop and I replaced it in later versions. Pascal lets you do stupid things- it just makes you confirm that you do in fact want to do a stupid thing. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Daniël Mantione wrote: > > Op Sat, 2 Dec 2006, schreef Micha Nelissen: > >> Daniël Mantione wrote: >>> (1) I'm using the in English not so common "informatics" instead of >>> "computer science", because Dijkstra greatly disliked the term). >> How about "computing science", or is that too "Eindhovens" ? ;-) > > Dijkstra disliked the term because informaticians/computer scientists > don't study how a computer works. "Informatics is no more about computers Indeed, that's why I said "comput*ing*", i.e. the working with computers, but not the science of the computers themselves. Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Op Sat, 2 Dec 2006, schreef Micha Nelissen: > Daniël Mantione wrote: > > (1) I'm using the in English not so common "informatics" instead of > > "computer science", because Dijkstra greatly disliked the term). > > How about "computing science", or is that too "Eindhovens" ? ;-) Dijkstra disliked the term because informaticians/computer scientists don't study how a computer works. "Informatics is no more about computers than astronomy is about telescopes" is a well known statement from him. Topics like algoritm design, computability theory, formal language theory, computation models, automata theory, they have indeed very little to do with actual working computers and to do research on the topic pen and paper is much more usefull than a computer. Daniël___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
And that's the power of this promoting material. A big pascal hater prefers pascal to do things right! :D What do you think about the wording I used in my blog: http://beeography.wordpress.com/2006/12/02/this-is-the-smart-guy/ How does it affect C programmers who read that? :D -Bee- has Bee.ography at: http://beeography.wordpress.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Daniël Mantione wrote: > (1) I'm using the in English not so common "informatics" instead of > "computer science", because Dijkstra greatly disliked the term). How about "computing science", or is that too "Eindhovens" ? ;-) Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
* The statement is wrong, pascal allows you to do wrong things. You just need to use some typecasts (specially to pointer). We can do wrong things almost on anything. It's just the matter of (1) how we use it [properly] and (2) how it prevents misuse of itself. In this discussion, the point (1) refers to the programmers, and point (2) refers to the language. So, when point (1) refers to a world-wide known as good programmer, OS maker, etc. (no matter what language he actually uses) and point (2) refers to Pascal, that'd be a good material for promoting Pascal. Is it? * It´s written by someone with a strong dislike for pascal. And that's the power of this promoting material. A big pascal hater prefers pascal to do things right! :D -Bee- has Bee.ography at: http://beeography.wordpress.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Op Sat, 2 Dec 2006, schreef Micha Nelissen: > Bisma Jayadi wrote: > > Linus concluded, "the C language has scoping rules for a reason. *If I > > wanted a language that didn't allow me to do anything wrong, I'd be > > using Pascal.* As it is, it turns out that things that 'look' wrong on a > > local level are often not wrong after all." > > Well, Linus is not too fond of "standard Pascal" (but neither am I ;-) > ), read the following about goto and labels: > (http://kerneltrap.org/node/553/2131) > > > On 12 Jan 2003, Robert Love wrote: > > On Sun, 2003-01-12 at 15:22, Linus Torvalds wrote: > > > No, you've been brainwashed by CS people who thought that Niklaus > > > Wirth actually knew what he was talking about. He didn't. He > > > doesn't have a frigging clue. > > > > I thought Edsger Dijkstra coined the "gotos are evil" bit in his > > structured programming push? > > Yeah, he did, but he's dead, and we shouldn't talk ill of the dead. So > these days I can only rant about Niklaus Wirth, who took the "structured > programming" thing and enforced it in his languages (Pascal and > Modula-2), and thus forced his evil on untold generations of poor CS > students who had to learn langauges that weren't actually useful for > real work. Wirth motivated his choices in an article in 2005 about "bad ideas" that people came up over the last decades. He still cosiders allowing goto in Pascal a mistake, and says he "didn't have the guts at that time" to remove goto. (He later removed it from Modula-2). The reality of the matter is that the original Pascal simply wasn't ready for removing goto (for instance, standard Pascal does not have break and continue). Looking at the use of goto in the Free Pascal sources, I see few situations were a non-goto solution is more attractive than the current one. So in essence, I don't disagree with Linus here. However, it should be noted, and this is what Linus forgets in his rants, is that Dijkstra and Wirth lived in an age were people were coding Cobol, Basic and Fortran programs without any high level structures at all. They had correctly concluded that in an ideal world, there would be ne need for goto, and were trying to design the ideal language. History has proved them almost completely right. The fact that in a real world practical situation the need for goto sometimes exists, doesn't make their enourmous contribution to informatics(1) invalid. Daniël (1) I'm using the in English not so common "informatics" instead of "computer science", because Dijkstra greatly disliked the term). ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
of course we could take it out of context and use to promote pascal, but: * The statement is wrong, pascal allows you to do wrong things. You just need to use some typecasts (specially to pointer). * It´s written by someone with a strong dislike for pascal. Unfortunately Linus still thinks people use 80s implementations of Pascal. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Daniël Mantione wrote: > Alas, he doesn't. Linus Torvalds stronly disapproves of Pascal and this > statement should be viewed in that context: he wants a language that does > allow him to do anything wrong. Actually: he wants a language to allows him to do things which are perceived by some to be wrong, but are not, after all. Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Bisma Jayadi wrote: > Linus concluded, "the C language has scoping rules for a reason. *If I > wanted a language that didn't allow me to do anything wrong, I'd be > using Pascal.* As it is, it turns out that things that 'look' wrong on a > local level are often not wrong after all." Well, Linus is not too fond of "standard Pascal" (but neither am I ;-) ), read the following about goto and labels: (http://kerneltrap.org/node/553/2131) On 12 Jan 2003, Robert Love wrote: > On Sun, 2003-01-12 at 15:22, Linus Torvalds wrote: > > No, you've been brainwashed by CS people who thought that Niklaus > > Wirth actually knew what he was talking about. He didn't. He > > doesn't have a frigging clue. > > I thought Edsger Dijkstra coined the "gotos are evil" bit in his > structured programming push? Yeah, he did, but he's dead, and we shouldn't talk ill of the dead. So these days I can only rant about Niklaus Wirth, who took the "structured programming" thing and enforced it in his languages (Pascal and Modula-2), and thus forced his evil on untold generations of poor CS students who had to learn langauges that weren't actually useful for real work. (Yeah, yeah, most _practical_ versions of Pascal ended up having all the stuff necessary to break structure, but as you may be able to tell, I was one of the unwashed masses who had to write in "standard Pascal" in my youth. I'm scarred for life). Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Alas, he doesn't. Linus Torvalds stronly disapproves of Pascal and this statement should be viewed in that context: he wants a language that does allow him to do anything wrong. Yeah, I understand. But as he mention this sentence... "If I wanted a language that didn't allow me to do anything wrong, I'd be using Pascal." then we can use it to promote pascal to public, no matter the real context of what Linus said. We have a very good material for promoting: a world-wide known c programer is stating good things about pascal. Funny thing is, L505 is in that thread and doing some nice advocacy :) Yup... I always like his efforts promoting pascal without disfiguring other language(s). I like the way he promotes pascal. :) -Bee- has Bee.ography at: http://beeography.wordpress.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] even linus torvalds prefer pascal over c
Op Sat, 2 Dec 2006, schreef Bisma Jayadi: > http://kerneltrap.org/node/7434 > > Quoted: > Linus concluded, "the C language has scoping rules for a reason. *If I wanted > a language that didn't allow me to do anything wrong, I'd be using Pascal.* As > it is, it turns out that things that 'look' wrong on a local level are often > not wrong after all." > > Good material for object pascal propaganda. ;) Alas, he doesn't. Linus Torvalds stronly disapproves of Pascal and this statement should be viewed in that context: he wants a language that does allow him to do anything wrong. Funny thing is, L505 is in that thread and doing some nice advocacy :) Daniël___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] even linus torvalds prefer pascal over c
http://kerneltrap.org/node/7434 Quoted: Linus concluded, "the C language has scoping rules for a reason. *If I wanted a language that didn't allow me to do anything wrong, I'd be using Pascal.* As it is, it turns out that things that 'look' wrong on a local level are often not wrong after all." Good material for object pascal propaganda. ;) -Bee- has Bee.ography at: http://beeography.wordpress.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal