Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #29244 > unrolled thread
| Started by | jonas.thornvall@gmail.com |
|---|---|
| First post | 2016-01-16 04:19 -0800 |
| Last post | 2016-01-19 16:48 +0000 |
| Articles | 16 on this page of 56 — 16 participants |
Back to article view | Back to comp.lang.javascript
Using break in while loops bad habit? jonas.thornvall@gmail.com - 2016-01-16 04:19 -0800
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-16 13:59 +0100
Re: Using break in while loops bad habit? Philip Herlihy <thiswillbounceback@you.com> - 2016-01-16 15:41 +0000
Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-16 16:41 -0800
Re: Using break in while loops bad habit? Philip Herlihy <thiswillbounceback@you.com> - 2016-01-16 13:02 +0000
Re: Using break in while loops bad habit? Tim Streater <timstreater@greenbee.net> - 2016-01-16 13:43 +0000
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-16 14:56 +0100
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-18 09:39 -0800
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-18 19:16 +0100
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-23 10:32 -0800
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-24 00:49 +0100
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-25 21:36 -0800
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-26 10:12 +0100
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-26 11:11 -0800
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-26 22:48 +0100
Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-26 15:03 -0800
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-27 00:51 +0100
Re: Using break in while loops bad habit? Norman Peelman <npeelman@cfl.rr.com> - 2016-01-23 21:00 -0500
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-25 21:39 -0800
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-26 10:17 +0100
Re: Using break in while loops bad habit? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-01-26 17:10 +0000
Re: Using break in while loops bad habit? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-01-26 16:44 +0000
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-26 11:17 -0800
Re: Using break in while loops bad habit? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-01-27 05:00 +0000
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-27 09:29 -0800
Re: Using break in while loops bad habit? Norman Peelman <npeelman@cfl.rr.com> - 2016-01-23 20:53 -0500
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-24 10:28 +0100
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-25 21:41 -0800
Re: Using break in while loops bad habit? Robert Heller <heller@deepsoft.com> - 2016-01-16 09:06 -0600
Re: Using break in while loops bad habit? Tim Streater <timstreater@greenbee.net> - 2016-01-16 17:31 +0000
Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-16 16:52 -0800
Re: Using break in while loops bad habit? Aleksandro <aleksandro@gmx.com> - 2016-01-16 12:43 -0300
Re: Using break in while loops bad habit? Silvio <silvio@internet.com> - 2016-01-16 17:51 +0100
Re: Using break in while loops bad habit? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-17 09:09 +0100
Re: Using break in while loops bad habit? John Harris <niam@jghnorth.org.uk.invalid> - 2016-01-17 11:19 +0000
Re: Using break in while loops bad habit? Silvio <silvio@internet.com> - 2016-01-18 00:40 +0100
Re: Using break in while loops bad habit? Andrew Poulos <ap_prog@hotmail.com> - 2016-01-18 13:53 +1100
Re: Using break in while loops bad habit? Silvio <silvio@internet.com> - 2016-01-18 07:59 +0100
Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-16 16:34 -0800
Re: Using break in while loops bad habit? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-17 01:29 +0000
Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-17 19:22 -0800
Re: Using break in while loops bad habit? Tim Streater <timstreater@greenbee.net> - 2016-01-18 10:00 +0000
Re: Using break in while loops bad habit? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-18 10:50 +0000
Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-20 16:40 -0800
Re: Using break in while loops bad habit? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-21 01:50 +0000
Re: Using break in while loops bad habit? Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-01-18 22:55 +0000
Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-18 16:10 -0800
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-18 09:46 -0800
Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-18 10:16 -0800
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-18 19:18 +0100
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-23 10:33 -0800
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-24 00:51 +0100
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-25 21:46 -0800
Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-26 10:22 +0100
Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-26 11:19 -0800
Re: Using break in while loops bad habit? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-01-19 16:48 +0000
Page 3 of 3 — ← Prev page 1 2 [3]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2016-01-17 19:22 -0800 |
| Message-ID | <ce9e7dab-baf1-49a5-a565-6ae644cce678@googlegroups.com> |
| In reply to | #29275 |
On Saturday, January 16, 2016 at 7:29:46 PM UTC-6, Ben Bacarisse wrote: > Did CPL have break? I can't find it in the most widely published paper > on CPL[1] but CPL evolved a lot and was never finalised so it may well > have acquired break by the end. Do you have a better reference? It's implied in the abstract of the BCPL document [1] > Did Algol have it? I don't think so. [...] > I'm not just nit-picking. Your idea is that it's lost in time in some > committee's vanished collective memory, but break seems to have been > added by BCPL -- a design be a single, still living, individual. So if > that's the case one could ask! It's a valid criticism. I did the listing from memory. Having read a number of perspectives on the ALGOL period and Structured Programming, it's very possible I only saw this feature in one of the suggested successors to ALGOL 60 that never saw the light. I took your advice and sent an email to Martin Richards [2] from my .edu account. With any luck he would be willing and able to give some more explicit insight on the time period and this feature. It was a tumultuous period indeed. [1] <https://www.bell-labs.com/usr/dmr/www/bcpl.pdf> [2] <http://www.cl.cam.ac.uk/~mr10/>
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2016-01-18 10:00 +0000 |
| Message-ID | <180120161000533285%timstreater@greenbee.net> |
| In reply to | #29300 |
In article <ce9e7dab-baf1-49a5-a565-6ae644cce678@googlegroups.com>, Michael Haufe (TNO) <tno@thenewobjective.com> wrote: >On Saturday, January 16, 2016 at 7:29:46 PM UTC-6, Ben Bacarisse wrote: > >> Did CPL have break? I can't find it in the most widely published paper >> on CPL[1] but CPL evolved a lot and was never finalised so it may well >> have acquired break by the end. Do you have a better reference? > >It's implied in the abstract of the BCPL document [1] It's more than implied. Section 3.7 Other controls of "BCPL, the language and its compiler", explicitly describes it. See also in the language definition, Chapter 8 section 8.5.7 Transfer of control. -- "Please stop telling us what you feel. Please stop telling us what your intuition is. Your intuitive feelings are of no interest whatsoever, and nor are mine. I don't give a bugger what you feel, or what I feel. I want to know what the evidence shows." -- Richard Dawkins
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-01-18 10:50 +0000 |
| Message-ID | <87mvs3b1q9.fsf@bsb.me.uk> |
| In reply to | #29300 |
"Michael Haufe (TNO)" <tno@thenewobjective.com> writes: > On Saturday, January 16, 2016 at 7:29:46 PM UTC-6, Ben Bacarisse wrote: > >> Did CPL have break? I can't find it in the most widely published paper >> on CPL[1] but CPL evolved a lot and was never finalised so it may well >> have acquired break by the end. Do you have a better reference? > > It's implied in the abstract of the BCPL document [1] That's a strong deduction to make from a casual remark! But since BCPL has clearly made other changes not listed there, I don't think you can conclude that removing types is literally the *only* change. >> Did Algol have it? I don't think so. > [...] >> I'm not just nit-picking. Your idea is that it's lost in time in some >> committee's vanished collective memory, but break seems to have been >> added by BCPL -- a design be a single, still living, individual. So if >> that's the case one could ask! > > It's a valid criticism. I did the listing from memory. Having read a > number of perspectives on the ALGOL period and Structured Programming, > it's very possible I only saw this feature in one of the suggested > successors to ALGOL 60 that never saw the light. > > I took your advice and sent an email to Martin Richards [2] from my > .edu account. With any luck he would be willing and able to give some > more explicit insight on the time period and this feature. It was a > tumultuous period indeed. Thanks. I'm be interested to hear what he says (and I wonder why I never thought to ask myself). It seems unlikely that break was invented for BCPL, but you never know... CPL seems to have had a rather chaotic design, so it may have had many features come and go. And what influences there were around at the time is hard to determine now. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2016-01-20 16:40 -0800 |
| Message-ID | <834018da-34c4-40f8-9c83-34f70c3de279@googlegroups.com> |
| In reply to | #29303 |
On Monday, January 18, 2016 at 4:50:47 AM UTC-6, Ben Bacarisse wrote: > "Michael Haufe (TNO)" writes: > > > On Saturday, January 16, 2016 at 7:29:46 PM UTC-6, Ben Bacarisse wrote: > > > >> Did CPL have break? I can't find it in the most widely published paper > >> on CPL[1] but CPL evolved a lot and was never finalised so it may well > >> have acquired break by the end. Do you have a better reference? > > > > It's implied in the abstract of the BCPL document [1] > > That's a strong deduction to make from a casual remark! But since BCPL > has clearly made other changes not listed there, I don't think you can > conclude that removing types is literally the *only* change. > > >> Did Algol have it? I don't think so. > > [...] > >> I'm not just nit-picking. Your idea is that it's lost in time in some > >> committee's vanished collective memory, but break seems to have been > >> added by BCPL -- a design be a single, still living, individual. So if > >> that's the case one could ask! > > > > It's a valid criticism. I did the listing from memory. Having read a > > number of perspectives on the ALGOL period and Structured Programming, > > it's very possible I only saw this feature in one of the suggested > > successors to ALGOL 60 that never saw the light. > > > > I took your advice and sent an email to Martin Richards [2] from my > > .edu account. With any luck he would be willing and able to give some > > more explicit insight on the time period and this feature. It was a > > tumultuous period indeed. > > Thanks. I'm be interested to hear what he says (and I wonder why I > never thought to ask myself). It seems unlikely that break was invented > for BCPL, but you never know... CPL seems to have had a rather chaotic > design, so it may have had many features come and go. And what > influences there were around at the time is hard to determine now. I got a reply today from Martin Richards. CPL did indeed have 'BREAK'. To partially quote: "CPL did have a break command to cause an exit from a repetitive command such as while or until. As far as I remember it did not have an equivalent of continue, but the equivalent loop command was added to BCPL early in 1967." [...] "The introduction of break in CPL was almost certainly influenced by Dijkstra's paper..." He also provided the following document (see page 5): <http://www.cl.cam.ac.uk/~mr10/cpl2bcpl.pdf>
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-01-21 01:50 +0000 |
| Message-ID | <8737tr1z0f.fsf@bsb.me.uk> |
| In reply to | #29384 |
"Michael Haufe (TNO)" <tno@thenewobjective.com> writes: > On Monday, January 18, 2016 at 4:50:47 AM UTC-6, Ben Bacarisse wrote: >> "Michael Haufe (TNO)" writes: <snip> >> > I took your advice and sent an email to Martin Richards [2] from my >> > .edu account. With any luck he would be willing and able to give some >> > more explicit insight on the time period and this feature. It was a >> > tumultuous period indeed. >> >> Thanks. I'm be interested to hear what he says (and I wonder why I >> never thought to ask myself). It seems unlikely that break was invented >> for BCPL, but you never know... CPL seems to have had a rather chaotic >> design, so it may have had many features come and go. And what >> influences there were around at the time is hard to determine now. > > I got a reply today from Martin Richards. CPL did indeed have > 'BREAK'. Ah, right. > To partially quote: > > "CPL did have a break command to cause an exit from a repetitive > command such as while or until. As far as I remember it did not have > an equivalent of continue, but the equivalent loop command was added > to BCPL early in 1967." > [...] > "The introduction of break in CPL was almost certainly influenced by > Dijkstra's paper..." > > He also provided the following document (see page 5): > > <http://www.cl.cam.ac.uk/~mr10/cpl2bcpl.pdf> Very interesting. Thank you. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> |
|---|---|
| Date | 2016-01-18 22:55 +0000 |
| Message-ID | <fhOOdwaK1WnWFwbs@invalid.uk.co.demon.merlyn.invalid> |
| In reply to | #29275 |
In comp.lang.javascript message <87io2tf0xq.fsf@bsb.me.uk>, Sun, 17 Jan 2016 01:29:37, Ben Bacarisse <ben.usenet@bsb.me.uk> posted: >Did CPL have break? I can't find it in the most widely published paper >on CPL[1] but CPL evolved a lot and was never finalised so it may well >have acquired break by the end. Do you have a better reference? CPL has or had break --- but I don't know enough to tell whether it is the *same* CPL. Web page <http://www.copleycontrols.com/Motion/pdf/CPL-quick.pdf>, page 2, column 2, middle refers. -- (c) John Stockton, Surrey, UK. ¬@merlyn.demon.co.uk Turnpike v6.05 MIME. Merlyn Web Site < > - FAQish topics, acronyms, & links.
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2016-01-18 16:10 -0800 |
| Message-ID | <69a422ca-a29c-4de9-810a-3e7a3ae80455@googlegroups.com> |
| In reply to | #29338 |
On Monday, January 18, 2016 at 5:45:42 PM UTC-6, Dr J R Stockton wrote: > CPL has or had break --- but I don't know enough to tell whether it is > the *same* CPL. > > Web page <http://www.copleycontrols.com/Motion/pdf/CPL-quick.pdf>, page > 2, column 2, middle refers. Afraid not. We're referring to Combined Programming Language. Your reference is for Compiled Motion Language.
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2016-01-18 09:46 -0800 |
| Message-ID | <g49q9b5ou0fksfu2jgrlelvk4m355rjn46@4ax.com> |
| In reply to | #29272 |
On Sat, 16 Jan 2016 16:34:12 -0800 (PST), "Michael Haufe (TNO)"
<tno@thenewobjective.com> wrote:
>On Saturday, January 16, 2016 at 6:20:15 AM UTC-6, jonas.t...@gmail.com wrote:
>> I have a question regarding the use of breaks in while loops, it seem most breaks can be avoided by adding extra conditions for the loop.
[snip]
>> What was the main reason to include break in the language?
>
>Simply put: because Java had it. [3]
Even more simply put: because it is useful.
[snip]
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2016-01-18 10:16 -0800 |
| Message-ID | <741f34b7-96dc-437e-9b4f-ccfd95eb2ab2@googlegroups.com> |
| In reply to | #29314 |
On Monday, January 18, 2016 at 11:46:32 AM UTC-6, Gene Wirchenko wrote: > On Sat, 16 Jan 2016 16:34:12 -0800 (PST), "Michael Haufe (TNO)" > >Simply put: because Java had it. [3] > > Even more simply put: because it is useful. True or not, this is not the reason JavaScript has the feature.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2016-01-18 19:18 +0100 |
| Message-ID | <XnsA593C468FCA75eejj99@194.109.6.166> |
| In reply to | #29314 |
Gene Wirchenko <genew@telus.net> wrote on 18 Jan 2016 in comp.lang.javascript: >>> What was the main reason to include break in the language? >> >>Simply put: because Java had it. [3] > > Even more simply put: because it is useful. > Gotos are useful too. Usefullness should not be THE measure of things. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2016-01-23 10:33 -0800 |
| Message-ID | <qqh7abpjncgpnlf1ivfeflqjdu470sjf2c@4ax.com> |
| In reply to | #29319 |
On Mon, 18 Jan 2016 19:18:28 +0100, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:
>Gene Wirchenko <genew@telus.net> wrote on 18 Jan 2016 in
>comp.lang.javascript:
>
>>>> What was the main reason to include break in the language?
>>>
>>>Simply put: because Java had it. [3]
>>
>> Even more simply put: because it is useful.
>>
>
>Gotos are useful too.
>
>Usefullness should not be THE measure of things.
Yes, but it is one of them. Quite often, it is the most
important or very high in priority.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2016-01-24 00:51 +0100 |
| Message-ID | <XnsA5998D04EB7eejj99@194.109.6.166> |
| In reply to | #29417 |
Gene Wirchenko <genew@telus.net> wrote on 23 Jan 2016 in comp.lang.javascript: >>Gotos are useful too. >> >>Usefullness should not be THE measure of things. > > Yes, but it is one of them. One of the measures of things? > Quite often, it is the most > important or very high in priority. No it is not, or it should not, not ever, in programming language developement. Sound logic is far more important. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2016-01-25 21:46 -0800 |
| Message-ID | <9p1eablc29qqfq8nl8ak5604nqiphh2ns1@4ax.com> |
| In reply to | #29425 |
On Sun, 24 Jan 2016 00:51:59 +0100, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:
>Gene Wirchenko <genew@telus.net> wrote on 23 Jan 2016 in
>comp.lang.javascript:
>
>>>Gotos are useful too.
>>>
>>>Usefullness should not be THE measure of things.
>>
>> Yes, but it is one of them.
>
>One of the measures of things?
Yes. Examples of multiple measures of things (and that can apply
to code) are cost, correctness, robustness, maintainability, and
speed.
>> Quite often, it is the most
>> important or very high in priority.
>
>No it is not, or it should not, not ever,
>in programming language developement.
If the code is not useful, why even bother writing it?
>Sound logic is far more important.
Less important.
If the code is not going to be useful, the sound logic in it is
irrelevant. (There may be sound logic outside of the programming
sphere that states that the code you want to write would be a waste of
resources.)
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2016-01-26 10:22 +0100 |
| Message-ID | <XnsA59B6984A107Aeejj99@194.109.6.166> |
| In reply to | #29444 |
Gene Wirchenko <genew@telus.net> wrote on 26 Jan 2016 in comp.lang.javascript: > (There may be sound logic outside of the programming sphere Do you realy think so? Not in my experience. > that states that the code you want to write would be a waste of > resources.) Well, living is a waste of resources, programming perhaps even more so. On the other hand, programmes could be far more efficient without any people around messing things up. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2016-01-26 11:19 -0800 |
| Message-ID | <iihfab15h4k03e9t1fqubqjva0q39ml1jg@4ax.com> |
| In reply to | #29447 |
On Tue, 26 Jan 2016 10:22:22 +0100, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:
>Gene Wirchenko <genew@telus.net> wrote on 26 Jan 2016 in
>comp.lang.javascript:
>
>> (There may be sound logic outside of the programming sphere
>
>Do you realy think so? Not in my experience.
Live and learn. Two possible reasons are:
That will cost too much time. We need this for business reasons
by <deadline>.
That will cost too much money. We can not afford it.
>> that states that the code you want to write would be a waste of
>> resources.)
>
>Well,
>living is a waste of resources,
>programming perhaps even more so.
>
>On the other hand,
>programmes could be far more efficient
>without any people around messing things up.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | Doc O'Leary <droleary@2015usenet1.subsume.com> |
|---|---|
| Date | 2016-01-19 16:48 +0000 |
| Message-ID | <n7lpct$7t0$1@dont-email.me> |
| In reply to | #29314 |
For your reference, records indicate that
Gene Wirchenko <genew@telus.net> wrote:
> Even more simply put: because it is useful.
Better: because that’s the way it *actually* works. Loops are all
conceptually the same. They go round and round (i.e., jump from the end
to the beginning) until there is a reason to break out of them (i.e.,
jump past the end). It is a mere language convention/convenience that
*one* particular set of exit conditions is given with the control
statement.
for (var foo = 0; foo < 16; foo++)
{
document.write('bar<br/>');
}
is the same as
var foo = 0;
while (foo < 16)
{
document.write('bar<br/>');
foo++;
}
is the same as
var foo = 0;
while (1)
{
if (foo > 15) break;
document.write('bar<br/>');
foo++;
}
Languages like JS that have a proliferation of loop types (especially
ones that torture syntax conventions like do-while does) are less pure.
It could just as easily be argued that break should be kept and all the
those arbitrary loop “wrappers” should go.
The only way it makes computational sense to get rid of arbitrary breaks
is to add a construct that can be evaluated to a *known* non-infinite
number. Iterators do that. But even then you’ll run into situations
where you want to get just the *first* of some item in a list that
matches some criteria, and it make no sense to loop over the rest of the
list after it has been found.
--
"Also . . . I can kill you with my brain."
River Tam, Trash, Firefly
[toc] | [prev] | [standalone]
Page 3 of 3 — ← Prev page 1 2 [3]
Back to top | Article view | comp.lang.javascript
csiph-web