Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Dijkstra probably hates me (Linus Torvalds, in kernel/sched.c)


devel / comp.lang.misc / Structured Programming

SubjectAuthor
* Structured ProgrammingCharles Lindsey
`* Re: Structured ProgrammingJames Harris
 +* Re: Structured ProgrammingBart
 |`- Re: Structured ProgrammingJames Harris
 `- Re: Structured ProgrammingCharles Lindsey

1
Structured Programming

<ifi289Fpgs6U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=159&group=comp.lang.misc#159

  copy link   Newsgroups: comp.lang.misc
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: chl@clerew.man.ac.uk (Charles Lindsey)
Newsgroups: comp.lang.misc
Subject: Structured Programming
Date: Thu, 6 May 2021 12:29:12 +0100
Lines: 13
Message-ID: <ifi289Fpgs6U1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net IvuT8kZHZioq8OCpIR0fFAT6ZCMtd7nSTPQlYTgyC8hZEdgzg=
Cancel-Lock: sha1:LJW+FAhrV3kFD5mb7akwOXM2bi0=
X-Mozilla-News-Host: news://news.individual.net:119
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.10.0
Content-Language: en-US
 by: Charles Lindsey - Thu, 6 May 2021 11:29 UTC

Some months back, when we were discussing which GOTOs could be considered
"harmless" in block-structured languages, I mentioned a paper which I had
written in 1977 for SIGPLAN Notices, and I promised to put its text up on my
website; but sadly I had lost access to the machine where my website was restored.

I have now reconstructed my website on a different machine, so you can now find
that paper if you look at http://www.clerew.man.ac.uk.

--
Charles H. Lindsey ---------At my New Home, still doing my own thing-----------
Tel: +44 161 488 1845 Web: http://www.cs.man.ac.uk/~chl
Email: chl@clerew.man.ac.uk Snail: 40 SK8 5BF, U.K.
PGP: 2C15F1A9 Fingerprint: 73 6D C2 51 93 A0 01 E7 65 E8 64 7E 14 A4 AB A5

Re: Structured Programming

<s72teg$20a$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=161&group=comp.lang.misc#161

  copy link   Newsgroups: comp.lang.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: james.harris.1@gmail.com (James Harris)
Newsgroups: comp.lang.misc
Subject: Re: Structured Programming
Date: Fri, 7 May 2021 09:23:44 +0100
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <s72teg$20a$1@dont-email.me>
References: <ifi289Fpgs6U1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 7 May 2021 08:23:44 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="165d27574c71436e6d9e10bc706f73d1";
logging-data="2058"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qHM7MKiyWRDWA3FZKcBjlIHK9Wa6zDbY="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.8.1
Cancel-Lock: sha1:rfA/HBg5OHvzOVIcQjhVg+XDRNA=
In-Reply-To: <ifi289Fpgs6U1@mid.individual.net>
Content-Language: en-US
 by: James Harris - Fri, 7 May 2021 08:23 UTC

On 06/05/2021 12:29, Charles Lindsey wrote:
> Some months back, when we were discussing which GOTOs could be
> considered "harmless" in block-structured languages, I mentioned a paper
> which I had written in 1977 for SIGPLAN Notices, and I promised to put
> its text up on my website; but sadly I had lost access to the machine
> where my website was restored.
>
> I have now reconstructed my website on a different machine, so you can
> now find that paper if you look at http://www.clerew.man.ac.uk.

Thanks, Charles. Good points about where to place labels to avoid
spaghetti code - especially for 1977!

What you say about 'completers' seems to match what I was suggesting in
our earlier discussion except, perhaps, that I was suggesting that exits
or 'completions' could be /via/ fragments of code.

I know your comments were about avoiding spaghetti code but what do you
see now as the overall merits or demerits of what you called 'repeaters'
compared with using an outer loop to effect the repetition?

I should say I couldn't quite match up the Algol on p47 with the
flowchart on p44 but Algol seems to me a strange beast!

--
James Harris

Re: Structured Programming

<I39lI.202247$i669.155728@fx02.ams4>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=163&group=comp.lang.misc#163

  copy link   Newsgroups: comp.lang.misc
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx02.ams4.POSTED!not-for-mail
Subject: Re: Structured Programming
Newsgroups: comp.lang.misc
References: <ifi289Fpgs6U1@mid.individual.net> <s72teg$20a$1@dont-email.me>
From: bc@freeuk.com (Bart)
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.10.0
MIME-Version: 1.0
In-Reply-To: <s72teg$20a$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-GB
Content-Transfer-Encoding: 7bit
X-Antivirus: AVG (VPS 210507-2, 07/05/2021), Outbound message
X-Antivirus-Status: Clean
Lines: 60
Message-ID: <I39lI.202247$i669.155728@fx02.ams4>
X-Complaints-To: http://netreport.virginmedia.com
NNTP-Posting-Date: Fri, 07 May 2021 10:58:48 UTC
Organization: virginmedia.com
Date: Fri, 7 May 2021 11:58:42 +0100
X-Received-Bytes: 3017
 by: Bart - Fri, 7 May 2021 10:58 UTC

On 07/05/2021 09:23, James Harris wrote:
> On 06/05/2021 12:29, Charles Lindsey wrote:
>> Some months back, when we were discussing which GOTOs could be
>> considered "harmless" in block-structured languages, I mentioned a
>> paper which I had written in 1977 for SIGPLAN Notices, and I promised
>> to put its text up on my website; but sadly I had lost access to the
>> machine where my website was restored.
>>
>> I have now reconstructed my website on a different machine, so you can
>> now find that paper if you look at http://www.clerew.man.ac.uk.
>
> Thanks, Charles. Good points about where to place labels to avoid
> spaghetti code - especially for 1977!
>
> What you say about 'completers' seems to match what I was suggesting in
> our earlier discussion except, perhaps, that I was suggesting that exits
> or 'completions' could be /via/ fragments of code.
>
> I know your comments were about avoiding spaghetti code but what do you
> see now as the overall merits or demerits of what you called 'repeaters'
> compared with using an outer loop to effect the repetition?
>
> I should say I couldn't quite match up the Algol on p47 with the
> flowchart on p44 but Algol seems to me a strange beast!

Nothing to do with Algol, since you can write the same thing with C (see
below). Just an incredibly confusing bit of code.

while ( (ptr ? letter < ptr->letter : true)
? /*invent new node;*/ false
: letter > ptr->letter) {
ptr = ptr->bother;
}

The 'invent new mode' part is a comment with the Algol code, but is an
actual box in the flowchart. The 'false' outcome (not shown in the
flowchart) means the loop imediately exits.

If I had to code this logic, I think it's too complex to do with
expressions:

do
if ptr=nil then
# invent new node
exit
end

if letter<ptr.letter then
# invent new node
exit
elsif letter=ptr.letter then
exit
end

ptr := ptr.brother # letter > ptr.letter
end

Nope, it's still confusing. Back to the drawing board I think.

Re: Structured Programming

<s739v4$oge$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=164&group=comp.lang.misc#164

  copy link   Newsgroups: comp.lang.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: james.harris.1@gmail.com (James Harris)
Newsgroups: comp.lang.misc
Subject: Re: Structured Programming
Date: Fri, 7 May 2021 12:57:23 +0100
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <s739v4$oge$1@dont-email.me>
References: <ifi289Fpgs6U1@mid.individual.net> <s72teg$20a$1@dont-email.me>
<I39lI.202247$i669.155728@fx02.ams4>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 7 May 2021 11:57:24 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="165d27574c71436e6d9e10bc706f73d1";
logging-data="25102"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LIAaZfAYq1vzjDgLy5yqz2LoVemleFfs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.8.1
Cancel-Lock: sha1:M8DRlil3kTDGoGT9mRddMUi5d0U=
In-Reply-To: <I39lI.202247$i669.155728@fx02.ams4>
Content-Language: en-US
 by: James Harris - Fri, 7 May 2021 11:57 UTC

On 07/05/2021 11:58, Bart wrote:

....

> If I had to code this logic, I think it's too complex to do with
> expressions:
>
>     do
>         if ptr=nil then
>             # invent new node
>             exit
>         end
>
>         if letter<ptr.letter then
>             # invent new node
>             exit
>         elsif letter=ptr.letter then
>             exit
>         end
>
>         ptr := ptr.brother   # letter > ptr.letter
>     end
>
> Nope, it's still confusing. Back to the drawing board I think.

I think the comparison may need to be against ptr.brother.letter but I'm
not sure. I have to say, though, you've done a great job in separating
out < and = which was confusing me.

If I start with your code my direct translation of it would be something
like

loop
if p eq null
action = NEW_NODE
end loop
if-end

if letter lt p*.letter
action = NEW_NODE
end loop
if-end

if letter eq p*.letter
action = 0
end loop
if-end

p = p*.brother ;letter gt p*.letter
loop-end

if action eq NEW_NODE
;Invent new node
if-end

However, it is an excellent example of where exit labels that I proposed
in the earlier discussion could be exploited. With exit labels it can become

loop

if p eq null so choose loop-newnode

if letter lt p*.letter so choose loop-newnode

if letter eq p*.letter so choose loop-end

p = p*.brother ;letter gt p*.letter

loop-newnode
;Invent new node

loop-end

--
James Harris

Re: Structured Programming

<ifkr93Fbhg8U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=165&group=comp.lang.misc#165

  copy link   Newsgroups: comp.lang.misc
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: chl@clerew.man.ac.uk (Charles Lindsey)
Newsgroups: comp.lang.misc
Subject: Re: Structured Programming
Date: Fri, 7 May 2021 13:48:34 +0100
Lines: 33
Message-ID: <ifkr93Fbhg8U1@mid.individual.net>
References: <ifi289Fpgs6U1@mid.individual.net> <s72teg$20a$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net b1hvYR3oRWPMm9EPhhNxBAvVBDmI2Ultd0N5YV2GrfkJt3qq8=
Cancel-Lock: sha1:tqqoGMKOuecMQqQgo8KCuUInHR4=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.10.0
In-Reply-To: <s72teg$20a$1@dont-email.me>
Content-Language: en-US
 by: Charles Lindsey - Fri, 7 May 2021 12:48 UTC

On 07/05/2021 09:23, James Harris wrote:

> Thanks, Charles. Good points about where to place labels to avoid spaghetti code
> - especially for 1977!
>
> What you say about 'completers' seems to match what I was suggesting in our
> earlier discussion except, perhaps, that I was suggesting that exits or
> 'completions' could be /via/ fragments of code.
>
> I know your comments were about avoiding spaghetti code but what do you see now
> as the overall merits or demerits of what you called 'repeaters' compared with
> using an outer loop to effect the repetition?

I think repeaters and completers are particularly useful when there are several
places in the loop where you might like to repeat or complete. But they also
offer the possibility (at least in my structure chart notation) of completing or
repeating a specific loop in some nested loop structure. Note also that they can
apply to any block, not just a loop.

But to achieve this, you have to be able to 'label' each block. In C, they apply
only to the innermost loop and you have to use jumps to get to the outer loops.
>
> I should say I couldn't quite match up the Algol on p47 with the flowchart on
> p44 but Algol seems to me a strange beast!

Yes, that notation in A68 works, but it is not obvious if you are unfamiliar
with it.

--
Charles H. Lindsey ---------At my New Home, still doing my own thing-----------
Tel: +44 161 488 1845 Web: http://www.cs.man.ac.uk/~chl
Email: chl@clerew.man.ac.uk Snail: 40 SK8 5BF, U.K.
PGP: 2C15F1A9 Fingerprint: 73 6D C2 51 93 A0 01 E7 65 E8 64 7E 14 A4 AB A5

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor