Prev: www.prevayler.org anyone do an in ram data base with transactionlog in tcl?
Next: accessing GUI with TWAPI (was: Accessing GUI of CAD through Tcl/Tk)
From: tom.rmadilo on 18 Dec 2009 18:01 On Dec 18, 1:48 pm, Rodericus <sc...(a)web.de> wrote: > On 18 Dez., 18:55, "tom.rmadilo" <tom.rmad...(a)gmail.com> wrote: > > > As Donal said, this [jump to other funktion] is beyond the abstraction of the C language, but > > isn't impossible. > > From Kernighan Ritchie's book: > > "A label has the same form as a variable name, and is followed by a > colon. It can be attached to > any statement in the same function as the goto. The scope of the label > is the entire function". > > This means, by definition of C is a goto to other procedure not > allowed. If it is possible, then > due to a bug in the compiler (it should give an error) or due the > hacker exploiting the bug. I'm thinking of buffer overflows. Maybe the original programmer didn't think about it, but viruses take advantage of this. > It stays also: > > "Although we are not dogmatic about the matter, it does seem that goto > statements should be used > rarely, if at all" > > The authors were aware of the dogmatic discussions. > > >> How are the local variables of the new procedure set? > > The way you "share" variables in C is to declare/define them outside the functions, > > But then they are not anymore local. There is also no memory allocated > for the arguments > of the function, that are also local: this is done when calling the > function, and this do > not happend when you jump inside. There is no local only solution if you use helper functions, the example below just demonstrates the equivalent syntax for Tcl (which doesn't support the file based variable scope). Another example is in sd-basic-exact-cover.tcl, which uses a global variable to hold the result. This just allows the print function to be external while maintaining everything else within one procedure. The sd::solveCellFast algo uses a recursive method which is slower, but solves arbitrary dimension puzzles. solveCellFast is compared to solveCell, which uses two external helper procedures. This series of experiments indicates that if speed is important, it is better to keep an open mind as to the organization of the program. But the key is organization. Most valid complaints about things like goto is that they lend themselves to becoming hacks and help produce spaghetti code. In essence, they can be used as an escape hatch for a poorly constructed program. In this case the mere fact that the spaghetti code "works". It is possible that since the developer wasn't implementing a well thought out algorithm that the code will fail in some cases which are not immediately apparent. If you have ever been stuck trying to untangle such code, you might start implementing a no- tolerance rule. > I could not reach the link: > > >http://www.junom.com/gitweb/gitweb.perl?p=sd.git;a=tree;f=test Copy and paste, looks like google groups has put in a redirect. (you can also go to the upper level and work your way down sd.git->tree- >test.
From: Les Cargill on 18 Dec 2009 21:13 Sean Woods wrote: > On Dec 16, 9:06 am, MSEdit <mse...(a)gmail.com> wrote: >> I am not sure where all this bloat you are seeing comes from. >> >> My 8.6 full GUI binary is 90k bigger than my 8.5.7 binary for me 90k >> is not bloat. >> >> Martyn > > Hey 90k used to be a huge deal. > > Back when we were dealing with 120k floppies. When I was a lad. And we > had to walk uphill both ways to school... http://video.google.com/videoplay?docid=2255807183978932387# Sorry. Been wanting to post that link all week. -- Les Cargill
From: Rodericus on 20 Dec 2009 08:25 tom.rmadilo schrieb: > On Dec 18, 1:48 pm, Rodericus <sc...(a)web.de> wrote: > There is no local only solution if you use helper functions, the > example below just demonstrates the equivalent syntax for Tcl (which > doesn't support the file based variable scope). If you are using non recursive function calls, then you could also write a (main) program not calling any function. Writing recursive programs is easier, I always try to avoid it, for making it more efficient. > This series of experiments indicates that if speed is important, it is > better to keep an open mind as to the organization of the program. But > the key is organization. I preffer analytical arguments than empirical ones with examples. Those that write operating systems are aware also of how the C compiler makes the object code. > Most valid complaints about things like goto > is that they lend themselves to becoming hacks and help produce > spaghetti code. Programs with goto can be more efficient, shorter, and much better readable. The argument against it was more or less ideological. You can find this discussions with google. Rodrigo.
From: Donal K. Fellows on 20 Dec 2009 11:49 On 20 Dec, 13:25, Rodericus <sc...(a)web.de> wrote: > The argument against [goto] was more or less ideological. You > can find this discussions with google. The argument's really a three-way one, between the extremists on either side, and the pragmatists in the middle. The extreme pro-goto position isn't seen very often though; you're the first person I've seen expound it for a while now. FWIW, you're in the position of advocating something that is sufficiently unpopular that people (reasonably) believe it was comprehensively defeated. I hope you've got new arguments to bring to the table... Donal.
From: Rodericus on 21 Dec 2009 08:16
Donal K. Fellows schrieb: > My phone, not a top of the range model by any means, massively outperforms it. A computer is not only a processor. Under circumstances periferals like keyboard and screen are much more important than the hardware inside, specially if you are using the computer as a typewriter. My first programming experience was with pocket calculators (HP 25, Casio fx 502p): inspite of the limitation I did programs that did meaningfull calculations for me. An old laptop is much more than a typewriter or a pocket calculator, and at a public library or archive you need to care of it less than of your telephone when you make a pause. Old microprossesors, even the oldest ones like 8038, are beeing produced till today for control purposes. I think it would be nice if Tcl continue running on old hardware. > The argument's really a three-way one, between the extremists on > either side, and the pragmatists in the middle. The extreme pro-goto > position isn't seen very often though; you're the first person I've > seen expound it for a while now. Do you think, the pragmatists forbide or completely hinder the use of goto like the proponents of structured GOTOless programming? I like the possition of K&R: they did not encourage the use of goto, but put one in C. My first computer programming language was FORTRAN IV, it is like my programming mother tongue, for many engeneers and scientists also. FORTRAN is alive, among those that do numerical calculations, not among computer scientists. Physicists and electric engeners tend also to program in assembler like any other language. These are programming languages with no other control flow than goto. The feeling for goto is, that it is a control flow primitive, that while, for, etc are just nice abreviations for some common structures of control flow. And from the point of view of the machine this is the case. There are other structures that are easily circumscribed with structured programming, perhaps so easy that you do not need to add new variables, but in many cases you feel gotos much more natural. Computer scientists are educated with other languages, they have other mother tongues, not only gotoless structured languages, perhaps object oriented or functional. In the whole discussion for and against goto you find continously the argument: I can do it my way (with or without goto) and this is what I would naturaly do. The discussion is only because you become aware of other ways of coding not a waste of time (see post of Kevin Kenny), but it has a big component of discussing about taste. > FWIW, you're in the position of advocating something that is sufficiently unpopular that people > (reasonably) believe it was comprehensively defeated. I hope you've > got new arguments to bring to the table... It is neither unpopular nor defeated. And I have no new arguments, I think there arent. The whole discussion is exhausted with casuistics. Most people like to hear music, other not only like to hear music, but also to be heared that they are hearing their predilect music, and mostly they are very loud. Object orientation was added to Tcl, but no goto instruction. Sure was John Ousterhout against goto, but it would be nice if someone asks him, what does he preffer, goto or objects in Tcl, and brings the answer to this newsgroup. Rodrigo. |