Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #23982
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2014-04-27 13:57 -0700 |
| References | (2 earlier) <0.a3b4f471693338248a20.20140426123508BST.87y4ys5no3.fsf@bsb.me.uk> <f4a2b34c-d7b7-4974-a6f6-1582ce0045ff@googlegroups.com> <0.6fc64329016b6998cc1a.20140426223412BST.87a9b76ai3.fsf@bsb.me.uk> <2f7c3181-f823-4cbf-9f86-c3d43e96f5cf@googlegroups.com> <0.9138ad1e35f363b22309.20140427154141BST.87r44i3kd6.fsf@bsb.me.uk> |
| Message-ID | <94ff2120-b86f-4d73-b5ca-3e38cd1dde7d@googlegroups.com> (permalink) |
| Subject | Re: Program logic weirdness? |
| From | jonas.thornvall@gmail.com |
Den söndagen den 27:e april 2014 kl. 16:41:41 UTC+2 skrev Ben Bacarisse: > jonas.thornvall@gmail.com writes: > > > > > Den lördagen den 26:e april 2014 kl. 23:34:12 UTC+2 skrev Ben Bacarisse: > > >> jonas.thornvall@gmail.com writes: > > >> <snip> > > >> > But that will still run a loop in each leg although technically only > > >> > one loop required? > > >> > > >> I tried to be clear, but if it isn't you are probably best off ignoring > > >> what I wrote. > > >> > > >> > Problem is if you have like fifty variables and > > >> > fifty conditions it will craate alot of overhead? > > >> > > >> I don't see why, but maybe I don't know what "overhead" means to you. > > >> To me, a complex system with dozens of conditions controlling actions on > > >> dozens of variables would be programmed quite differently, but the > > >> emphasis would be on clarity. It's going to be unreadable otherwise. > > <snip> > > > > > I think you are totally wrong Ben, we are basicly speaking about a > > > print/write function, and if one should be able to steer what will be > > > printout *before* one goes into the loop. > > > > > > Otherwise you will have to *fiddle* and doing unneccessary checks > > > *within* loop. > > > > That's why I suggested moving the test outside, but it does not fit for > > every situation. Your example was not clear on what the constraints > > were so I could do no more that guess at a possible alternative. > > > > > If you can not see this, you may still be a good programmer but i am > > > sure any program language you developed would be *convoluted*. > > > > That's kind of you, not! > > > > > Ben when you print out something in a loop, and there is 50 conditions > > > *on printouts* that is clear set before starting print/write, you do > > > not want to create a separate function for each or create a loop leg > > > for each? > > > > No I don't (and I hope it did not seem like I was suggesting that). The > > trouble with vague descriptions like "50 conditions" is that it matters > > what they are and what they control. My suggestion was based on a > > guess, which in turn was based on your example with a single condition. > > > > > It could be so simple that the IF clause are named (could be named and > > > unnamed) ifA ifB ifAA and so on and have a boolean flag. The default > > > could be set to false the condition is not fullfilled, but you are > > > able to set the boolean flag to true. The if statement already > > > fullfilled no need to check again. > > > > There are ways to do that in conventional programming languages but they > > will all be unacceptable to you. > > > > > Rather then looping and checking 50 *unnecessary* conditions for each > > > round of loop printing out millions of values. No and i do not prefer > > > 50 loops running in 50 functions. > > > > Which no one has suggested. 50 function call might, however, be a > > reasonable solution (remember, the designers of ECMAScript have omitted > > the feature you want, so you must make do with what they did think of > > providing). > > > > > I prefer a simple boolean switch upon the if clause, and it is a > > > mystery that i do not know any programming that can handle such a > > > simple task. > > > > I used to think that all the time. Every time I came across a > > programming pattern that was not supported directly by the language I > > was using that day, I thought, "what Fortran, SASL, LISP, BCPL, Algol > > 68, Snobol (or whatever) needs is feature X or Y or Z". Sometimes > > that's the right thought, and sometimes it isn't. It's surprisingly > > hard to know when it is and when it isn't. > > > > -- > > Ben. I could surprise you with my cobol skills ;D
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-25 22:53 -0700
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-25 22:57 -0700
Re: Program logic weirdness? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-26 12:35 +0100
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-26 07:59 -0700
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-26 08:11 -0700
Re: Program logic weirdness? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-26 22:34 +0100
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-27 00:44 -0700
Re: Program logic weirdness? Tim Streater <timstreater@greenbee.net> - 2014-04-27 13:20 +0100
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-27 06:09 -0700
Re: Program logic weirdness? Tim Streater <timstreater@greenbee.net> - 2014-04-27 18:30 +0100
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-27 12:13 -0700
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-28 02:33 -0700
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-27 06:25 -0700
Re: Program logic weirdness? Denis McMahon <denismfmcmahon@gmail.com> - 2014-04-27 14:55 +0000
Re: Program logic weirdness? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-27 15:41 +0100
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-27 13:57 -0700
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-25 23:18 -0700
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-25 23:23 -0700
Re: Program logic weirdness? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-04-26 15:06 +0200
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-26 08:00 -0700
Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-26 08:06 -0700
csiph-web