Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

If graphics hackers are so smart, why can't they get the bugs out of fresh paint?


computers / comp.os.vms / Re: BASIC (and Horizon)

SubjectAuthor
* BASIC (and Horizon)Simon Clubley
`* Re: BASIC (and Horizon)Arne Vajhøj
 `* Re: BASIC (and Horizon)kludge
  +- Re: BASIC (and Horizon)Lawrence D'Oliveiro
  +* Re: BASIC (and Horizon)Arne Vajhøj
  |`* Re: BASIC (and Horizon)Dave Froble
  | +* Re: BASIC (and Horizon)Chris Townley
  | |`* Re: BASIC (and Horizon)Dave Froble
  | | +* Re: BASIC (and Horizon)Chris Townley
  | | |`* Re: BASIC (and Horizon)Dave Froble
  | | | +- Re: BASIC (and Horizon)Chris Townley
  | | | `- Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | +* Re: BASIC (and Horizon)Michael S
  | | |+* Re: BASIC (and Horizon)Scott Dorsey
  | | ||`* Re: BASIC (and Horizon)Arne Vajhøj
  | | || +- Re: BASIC (and Horizon)Dan Cross
  | | || `* Re: BASIC (and Horizon)Scott Dorsey
  | | ||  `* Re: BASIC (and Horizon)Arne Vajhøj
  | | ||   `- Re: BASIC (and Horizon)Scott Dorsey
  | | |`* Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | | `* Re: BASIC (and Horizon)Arne Vajhøj
  | | |  +* Re: BASIC (and Horizon)Dave Froble
  | | |  |`* Re: BASIC (and Horizon)Dan Cross
  | | |  | `* Re: BASIC (and Horizon)Dave Froble
  | | |  |  +* Re: BASIC (and Horizon)Single Stage to Orbit
  | | |  |  |+- Re: BASIC (and Horizon)Dan Cross
  | | |  |  |`* Re: BASIC (and Horizon)Dave Froble
  | | |  |  | `- Re: BASIC (and Horizon)Single Stage to Orbit
  | | |  |  +- Re: BASIC (and Horizon)Dan Cross
  | | |  |  +- Re: BASIC (and Horizon)Simon Clubley
  | | |  |  `- Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |  `* Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |   `* Re: BASIC (and Horizon)Arne Vajhøj
  | | |    +* Re: BASIC (and Horizon)Dan Cross
  | | |    |`* Re: BASIC (and Horizon)Simon Clubley
  | | |    | +- Re: BASIC (and Horizon)Dan Cross
  | | |    | `* Re: BASIC (and Horizon)Arne Vajhøj
  | | |    |  `- Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |    +* Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |    |+- Re: BASIC (and Horizon)Dan Cross
  | | |    |`* Re: BASIC (and Horizon)Arne Vajhøj
  | | |    | +* Re: BASIC (and Horizon)Dave Froble
  | | |    | |`* Re: BASIC (and Horizon)Arne Vajhøj
  | | |    | | `* Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |    | |  `* Re: BASIC (and Horizon)Arne Vajhøj
  | | |    | |   `- Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |    | `* Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |    |  +* Re: BASIC (and Horizon)Arne Vajhøj
  | | |    |  |`- Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |    |  `* Re: BASIC (and Horizon)Dan Cross
  | | |    |   `* Re: BASIC (and Horizon)Arne Vajhøj
  | | |    |    `- Re: BASIC (and Horizon)Dan Cross
  | | |    `- Re: BASIC (and Horizon)Dave Froble
  | | +* Re: BASIC (and Horizon)Arne Vajhøj
  | | |+* Re: BASIC (and Horizon)Simon Clubley
  | | ||`- Re: BASIC (and Horizon)Arne Vajhøj
  | | |`* Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | | `* Re: BASIC (and Horizon)Arne Vajhøj
  | | |  `* Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |   `* Re: BASIC (and Horizon)Arne Vajhøj
  | | |    `* Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |     `* Re: BASIC (and Horizon)Arne Vajhøj
  | | |      `* Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | |       `* Re: BASIC (and Horizon)Arne Vajhøj
  | | |        +- Re: BASIC (and Horizon)Arne Vajhøj
  | | |        `- Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | | `* Re: BASIC (and Horizon)Stephen Hoffman
  | |  `* Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | |   `* Re: BASIC (and Horizon)Stephen Hoffman
  | |    `- Re: BASIC (and Horizon)Lawrence D'Oliveiro
  | `- Re: BASIC (and Horizon)Arne Vajhøj
  `* Re: BASIC (and Horizon)bill
   +* Re: BASIC (and Horizon)Chris Townley
   |`- Re: BASIC (and Horizon)bill
   +* Re: BASIC (and Horizon)Scott Dorsey
   |`* Re: BASIC (and Horizon)bill
   | `* Re: BASIC (and Horizon)Bob Eager
   |  `* Re: BASIC (and Horizon)Lawrence D'Oliveiro
   |   `- Re: BASIC (and Horizon)Michael S
   `* Re: BASIC (and Horizon)Andreas Eder
    `- Re: BASIC (and Horizon)bill

Pages:1234
Re: BASIC (and Horizon)

<upedk5$1mjib$4@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33110&group=comp.os.vms#33110

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 21:21:10 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <upedk5$1mjib$4@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <l1sne0Fi5hqU2@mid.individual.net>
<upc3g9$7r6$1@panix2.panix.com> <l1tllhFi5hqU3@mid.individual.net>
<l1ujm7Ff0eoU5@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 31 Jan 2024 21:21:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6d6e39d72828d64573e6503e5cd44852";
logging-data="1789515"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jEdVqtWpBcebdIU3PqiN5"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:eAJzCR58Ob+jDdPKDfLN5qbsCeU=
 by: Lawrence D'Oliv - Wed, 31 Jan 2024 21:21 UTC

On 31 Jan 2024 09:54:15 GMT, Bob Eager wrote:

> We had a machine that ran FORTRAN for the physics department. One guy
> had a program that crashed the machine. As in, the microcode halted.
> That was an array bounds error.
>
> Full story:
>
> http://www.bobeager.uk/anecdotes.html#hwhack

We contacted ICL, but we never seemed to reach anyone who either
understood what the problem was, or had the power or inclination
to get it fixed ...

If this was not after the Fujitsu acquisition, I assume it wasn’t long
before ...

Re: BASIC (and Horizon)

<upedmp$1mjib$5@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33111&group=comp.os.vms#33111

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 21:22:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <upedmp$1mjib$5@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <updr42$1jcmi$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 31 Jan 2024 21:22:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6d6e39d72828d64573e6503e5cd44852";
logging-data="1789515"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UzmvhAQr0Sn10tPJ61Dba"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:UnGnNXX2B3yNsvP6jUJvyh2d/jg=
 by: Lawrence D'Oliv - Wed, 31 Jan 2024 21:22 UTC

On Wed, 31 Jan 2024 11:05:22 -0500, Stephen Hoffman wrote:

> (Not that I prefer to have to implement manual cleanup, much as I'd like
> to avoid explicitly deallocating memory in C.

Note that free(3) is defined as idempotent; freeing a NULL pointer is a
harmless no-op. That simplifies things a lot.

Re: BASIC (and Horizon)

<upedpu$1mjib$6@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33112&group=comp.os.vms#33112

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 21:24:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <upedpu$1mjib$6@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <updog4$1itf7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 31 Jan 2024 21:24:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6d6e39d72828d64573e6503e5cd44852";
logging-data="1789515"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX182mbSfyW8PIAHfwr3wC2CO"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:vcgFK1zIXW0EJXqhI/UO/2SCkMg=
 by: Lawrence D'Oliv - Wed, 31 Jan 2024 21:24 UTC

On Wed, 31 Jan 2024 10:20:35 -0500, Arne Vajhøj wrote:

> For the not VB.NET knowledgable:
>
> Using o1 As New X("A")
> ...
> End Using
>
> calls o1.Dispose() when the block is exited no matter how it is exited -
> normal or exception does not matter Dispose is always called.

Python has “context managers” which are a generalization of this. It also
has “try/finally” blocks, which are good for one-off cases.

Re: BASIC (and Horizon)

<upee11$1mjib$7@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33113&group=comp.os.vms#33113

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 21:28:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <upee11$1mjib$7@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <20240131155230.00000457@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 31 Jan 2024 21:28:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6d6e39d72828d64573e6503e5cd44852";
logging-data="1789515"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+tAKhi/5A12Jd06Io9MujV"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:idfZcJzM2EvC6/bjej49M1rJDJU=
 by: Lawrence D'Oliv - Wed, 31 Jan 2024 21:28 UTC

On Wed, 31 Jan 2024 15:52:30 +0200, Michael S wrote:

> One option is named construct and named break.

I have never written a goto in C code (not production code, anyway). These
days, you need to do so much dynamic allocation, there is nearly always
some need for cleanup when exiting an inner block anyway, so you can’t
just jump directly somewhere else first. The overall pattern looks like
this:

MyPtr obj = NULL;
do /*once*/
{
... possible other stuff ...
«allocate memory for obj»;
if («error occurred»)
break;
... possible other stuff using obj ...
}
while (false);
free(obj);

You can confirm, just by inspection, that there is no path out of the
block that does not pass through the free() call precisely once.

Re: BASIC (and Horizon)

<20240131234340.00003244@yahoo.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33114&group=comp.os.vms#33114

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5chosen@yahoo.com (Michael S)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 23:43:40 +0200
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <20240131234340.00003244@yahoo.com>
References: <up8qmo$ima5$1@dont-email.me>
<up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com>
<l1sne0Fi5hqU2@mid.individual.net>
<upc3g9$7r6$1@panix2.panix.com>
<l1tllhFi5hqU3@mid.individual.net>
<l1ujm7Ff0eoU5@mid.individual.net>
<upedk5$1mjib$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: dont-email.me; posting-host="458330ddd435bd841a14cd8bf85c2e26";
logging-data="1769985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+l6jIdgrA3+86kSohyjgY2OCVWRcWyP4c="
Cancel-Lock: sha1:pMAncmMGg/vGiqpAN8+bUE8mu/M=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
 by: Michael S - Wed, 31 Jan 2024 21:43 UTC

On Wed, 31 Jan 2024 21:21:10 -0000 (UTC)
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

> On 31 Jan 2024 09:54:15 GMT, Bob Eager wrote:
>
> > We had a machine that ran FORTRAN for the physics department. One
> > guy had a program that crashed the machine. As in, the microcode
> > halted. That was an array bounds error.
> >
> > Full story:
> >
> > http://www.bobeager.uk/anecdotes.html#hwhack
>
> We contacted ICL, but we never seemed to reach anyone who either
> understood what the problem was, or had the power or inclination
> to get it fixed ...
>
> If this was not after the Fujitsu acquisition, I assume it wasn’t
> long before ...

From the article it looks like 1980, probably H1.

Re: BASIC (and Horizon)

<upegdc$1n0je$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33115&group=comp.os.vms#33115

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arne@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 17:08:44 -0500
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <upegdc$1n0je$1@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <20240131155230.00000457@yahoo.com>
<upee11$1mjib$7@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 31 Jan 2024 22:08:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2a64d8f6ae6973267bcb42c81335e468";
logging-data="1802862"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LNdL3yIpK9Os9iQmmg3Mb8ZC9niAGFeg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:RIeQzHtuZgKeavWwUp4HmaopJWU=
In-Reply-To: <upee11$1mjib$7@dont-email.me>
Content-Language: en-US
 by: Arne Vajhøj - Wed, 31 Jan 2024 22:08 UTC

On 1/31/2024 4:28 PM, Lawrence D'Oliveiro wrote:
> I have never written a goto in C code (not production code, anyway). These
> days, you need to do so much dynamic allocation, there is nearly always
> some need for cleanup when exiting an inner block anyway, so you can’t
> just jump directly somewhere else first. The overall pattern looks like
> this:
>
> MyPtr obj = NULL;
> do /*once*/
> {
> ... possible other stuff ...
> «allocate memory for obj»;
> if («error occurred»)
> break;
> ... possible other stuff using obj ...
> }
> while (false);
> free(obj);
>
> You can confirm, just by inspection, that there is no path out of the
> block that does not pass through the free() call precisely once.

And the difference compared to:

MyPtr obj = NULL;
... possible other stuff ...
«allocate memory for obj»;
if («error occurred»)
goto lbl_freeobj;
... possible other stuff using obj ...
lbl_freeobj:
free(obj);

are?

Arne

Re: BASIC (and Horizon)

<upegm7$1n0je$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33116&group=comp.os.vms#33116

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arne@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 17:13:26 -0500
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <upegm7$1n0je$2@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <updog4$1itf7$1@dont-email.me>
<upedpu$1mjib$6@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 31 Jan 2024 22:13:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2a64d8f6ae6973267bcb42c81335e468";
logging-data="1802862"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18LWEp+DKwcrrXE/0kqJeP1Z6GcuoX54w4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:N3CALVS4Ve68YAPZ4WRLGclLsb0=
Content-Language: en-US
In-Reply-To: <upedpu$1mjib$6@dont-email.me>
 by: Arne Vajhøj - Wed, 31 Jan 2024 22:13 UTC

On 1/31/2024 4:24 PM, Lawrence D'Oliveiro wrote:
> On Wed, 31 Jan 2024 10:20:35 -0500, Arne Vajhøj wrote:
>> For the not VB.NET knowledgable:
>>
>> Using o1 As New X("A")
>> ...
>> End Using
>>
>> calls o1.Dispose() when the block is exited no matter how it is exited -
>> normal or exception does not matter Dispose is always called.
>
> Python has “context managers” which are a generalization of this. It also
> has “try/finally” blocks, which are good for one-off cases.

C# was born with using (2002), Python got with in 2.5 (2006)
and Java got try with resource in 1.7 (2011).

MS got a good idea and the rest copied it.

Arne

Re: BASIC (and Horizon)

<upejl0$1nkl5$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33119&group=comp.os.vms#33119

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!nntp.comgw.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: davef@tsoft-inc.com (Dave Froble)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 18:04:52 -0500
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <upejl0$1nkl5$1@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <20240131155230.00000457@yahoo.com>
<upee11$1mjib$7@dont-email.me> <upegdc$1n0je$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 31 Jan 2024 23:04:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="67ae6c41f7b9c5cf3283faf444e1f5ca";
logging-data="1823397"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18c7oo8RqJrYoh37hTZ3/ufivONMiQvUXg="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:s06LqBhl9psz5mESRdlrrX5RXjs=
In-Reply-To: <upegdc$1n0je$1@dont-email.me>
 by: Dave Froble - Wed, 31 Jan 2024 23:04 UTC

On 1/31/2024 5:08 PM, Arne Vajhøj wrote:
> On 1/31/2024 4:28 PM, Lawrence D'Oliveiro wrote:
>> I have never written a goto in C code (not production code, anyway). These
>> days, you need to do so much dynamic allocation, there is nearly always
>> some need for cleanup when exiting an inner block anyway, so you can’t
>> just jump directly somewhere else first. The overall pattern looks like
>> this:
>>
>> MyPtr obj = NULL;
>> do /*once*/
>> {
>> ... possible other stuff ...
>> «allocate memory for obj»;
>> if («error occurred»)
>> break;
>> ... possible other stuff using obj ...
>> }
>> while (false);
>> free(obj);
>>
>> You can confirm, just by inspection, that there is no path out of the
>> block that does not pass through the free() call precisely once.
>
> And the difference compared to:
>
> MyPtr obj = NULL;
> ... possible other stuff ...
> «allocate memory for obj»;
> if («error occurred»)
> goto lbl_freeobj;
> ... possible other stuff using obj ...
> lbl_freeobj:
> free(obj);
>
> are?
>
> Arne
>
>

I've seen code that did all kinds of confusing things, just avoid a GoTo branch.
My question is, why? If the need is a simple and rather easy to understand
branch, why get complex, just to be "political correct", which ia also a rather
stupid concept.

--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486

Re: BASIC (and Horizon)

<upekfj$1nil8$6@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33120&group=comp.os.vms#33120

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 23:18:12 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <upekfj$1nil8$6@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <updog4$1itf7$1@dont-email.me>
<upedpu$1mjib$6@dont-email.me> <upegm7$1n0je$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 31 Jan 2024 23:18:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="292505b1016833b26c02e42290db7d4f";
logging-data="1821352"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+N4jN9bkJLSYAJdMyahxo7"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:r741ZpQTM5yfWYOKo/za/FG/S+g=
 by: Lawrence D'Oliv - Wed, 31 Jan 2024 23:18 UTC

On Wed, 31 Jan 2024 17:13:26 -0500, Arne Vajhøj wrote:

> On 1/31/2024 4:24 PM, Lawrence D'Oliveiro wrote:
>
>> On Wed, 31 Jan 2024 10:20:35 -0500, Arne Vajhøj wrote:
>>
>>> For the not VB.NET knowledgable:
>>>
>>> Using o1 As New X("A")
>>> ...
>>> End Using
>>>
>>> calls o1.Dispose() when the block is exited no matter how it is exited -
>>> normal or exception does not matter Dispose is always called.
>>
>> Python has “context managers” which are a generalization of this. It also
>> has “try/finally” blocks, which are good for one-off cases.
>
> C# was born with using (2002), Python got with in 2.5 (2006)
> and Java got try with resource in 1.7 (2011).
>
> MS got a good idea and the rest copied it.

That is also true of async/await. But note that Python is the only one
of the three that tries to use reference-counting as an alternative to
garbage collection.

And now it looks like C# might be shuffling off into those retirement
pastures
<https://www.theregister.com/2024/01/31/microsoft_seeks_rust_developers/>.

Re: BASIC (and Horizon)

<upeklu$1nil8$7@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33121&group=comp.os.vms#33121

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!nntp.comgw.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 23:21:34 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 108
Message-ID: <upeklu$1nil8$7@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <20240131155230.00000457@yahoo.com>
<upee11$1mjib$7@dont-email.me> <upegdc$1n0je$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 31 Jan 2024 23:21:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="292505b1016833b26c02e42290db7d4f";
logging-data="1821352"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+i7HkaxPAri8GIBWWVjRCX"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:Xmql2jFFmmBCrZ1z2FN+EJap2EI=
 by: Lawrence D'Oliv - Wed, 31 Jan 2024 23:21 UTC

On Wed, 31 Jan 2024 17:08:44 -0500, Arne Vajhøj wrote:

> On 1/31/2024 4:28 PM, Lawrence D'Oliveiro wrote:
>
>> I have never written a goto in C code (not production code, anyway). These
>> days, you need to do so much dynamic allocation, there is nearly always
>> some need for cleanup when exiting an inner block anyway, so you can’t
>> just jump directly somewhere else first. The overall pattern looks like
>> this:
>>
>> MyPtr obj = NULL;
>> do /*once*/
>> {
>> ... possible other stuff ...
>> «allocate memory for obj»;
>> if («error occurred»)
>> break;
>> ... possible other stuff using obj ...
>> }
>> while (false);
>> free(obj);
>>
>> You can confirm, just by inspection, that there is no path out of the
>> block that does not pass through the free() call precisely once.
>
> And the difference compared to:
>
> MyPtr obj = NULL;
> ... possible other stuff ...
> «allocate memory for obj»;
> if («error occurred»)
> goto lbl_freeobj;
> ... possible other stuff using obj ...
> lbl_freeobj:
> free(obj);
>
> are?

Nesting. Try to scale up to something like

static PyObject * discipline_makedict
(
PyObject * self,
PyObject * args
)
{
PyObject * result = NULL;
PyObject * tempresult = NULL;
br_PyObject * items;
const br_char * msg = NULL;
do /*once*/
{
const bool parsed_ok = PyArg_ParseTuple(args, "Os", &items, &msg);
if (not parsed_ok)
break;
fprintf(stdout, "makedict says: “%s”\n", msg);
if (not PyTuple_Check(items))
{
PyErr_SetString(PyExc_TypeError, "expecting a tuple");
break;
} /*if*/
const ssize_t nr_items = PyTuple_Size(items);
if (PyErr_Occurred())
break;
tempresult = PyDict_New();
if (tempresult == NULL)
break;
for (ssize_t i = 0;;)
{
if (i == nr_items)
break;
br_PyObject * const item = PyTuple_GetItem(items, i);
if (item == NULL)
break;
if (not PyTuple_Check(item) or PyTuple_Size(item) != 2)
{
PyErr_SetString(PyExc_TypeError, "expecting a 2-tuple");
break;
} /*if*/
br_PyObject * const first = PyTuple_GetItem(item, 0);
if (first == NULL)
break;
br_PyObject * const second = PyTuple_GetItem(item, 1);
if (second == NULL)
break;
if (first == (PyObject *)&ExceptMe_type or second == (PyObject *)&ExceptMe_type)
{
PyErr_SetString(PyExc_ValueError, "ExceptMe object found");
break;
} /*if*/
if (PyDict_SetItem(tempresult, first, second) < 0)
break;
++i;
} /*for*/
if (PyErr_Occurred())
break;
/* all done */
result = tempresult;
tempresult = NULL; /* so I don’t dispose of it yet */
}
while (false);
Py_XDECREF(tempresult);
return
result;
} /*discipline_makedict*/

More details here
<https://gitlab.com/ldo/a_structured_discipline_of_programming/>.

Re: BASIC (and Horizon)

<upenro$1nqj8$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33122&group=comp.os.vms#33122

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: news@cct-net.co.uk (Chris Townley)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 1 Feb 2024 00:15:52 +0000
Organization: A noiseless patient Spider
Lines: 93
Message-ID: <upenro$1nqj8$1@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <updcv8$1frdh$1@dont-email.me>
<upe3dn$1kr2b$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 1 Feb 2024 00:15:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d06ef80d95e9e261e20718627bcbaf8f";
logging-data="1829480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/J4opgs46JMDhOBf1MK4qH14t8fHeM0rU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:vUakNX0i7o/m08s2WiwQGUiPtmI=
Content-Language: en-GB
In-Reply-To: <upe3dn$1kr2b$1@dont-email.me>
 by: Chris Townley - Thu, 1 Feb 2024 00:15 UTC

On 31/01/2024 18:27, Dave Froble wrote:
> On 1/31/2024 7:03 AM, Chris Townley wrote:
>> On 31/01/2024 04:28, Dave Froble wrote:
>>> On 1/30/2024 9:40 AM, Chris Townley wrote:
>>>> On 30/01/2024 07:06, Dave Froble wrote:
>>>>> On 1/29/2024 8:02 PM, Arne Vajhøj wrote:
>>>>>> On 1/29/2024 7:50 PM, kludge@panix.com wrote:
>>>>>>> =?UTF-8?Q?Arne_Vajh=C3=B8j?=  <arne@vajhoej.dk> wrote:
>>>>>>>> The code is VB6.
>>>>>>>>
>>>>>>>> But none of the problems are Basic specific. It is possible
>>>>>>>> to write the same bad code in C or Fortran or whatever.
>>>>>>>>
>>>>>>>> So it just shows that there are some really really bad
>>>>>>>> programmers out
>>>>>>>> there.
>>>>>>>
>>>>>>> I have worked with people who could write spaghetti Fortran in any
>>>>>>> programming language available.
>>>>>>
>>>>>> "A real Fortran programmer can write Fortran in any language"
>>>>>>
>>>>>> Every time this comes up I post this Fortran/Pascal code:
>>>>>>
>>>>>>       PROGRAM GOTOFUN(INPUT,OUTPUT);
>>>>>>       LABEL L731,L113,L247,L588,L761,L922,L399,L601;
>>>>>>       VAR LBL:INTEGER;
>>>>>>       VAR I:INTEGER;
>>>>>>       BEGIN
>>>>>> L731: GOTO L113;
>>>>>>       LBL:=399;
>>>>>> L113: I:=0;
>>>>>>       WRITELN(I);
>>>>>> L247: LBL:=601;
>>>>>>       IF(I<0)THEN GOTO L588 ELSE IF(I=0)THEN GOTO L922 ELSE GOTO
>>>>>> L399;
>>>>>> L588: I:=I+1;
>>>>>>       WRITELN(I);
>>>>>>       GOTO L399;
>>>>>> L761: CASE(LBL)OF 399: GOTO L399; 601: GOTO L601; END;
>>>>>> L922: I:=I+1;
>>>>>>       WRITELN(I);
>>>>>>       CASE(I)OF 1: GOTO L588; 2: GOTO L399; 3: GOTO L922; END;
>>>>>> L399: GOTO L761;
>>>>>> L601: END.
>>>>>>
>>>>>> :-)
>>>>>>
>>>>>> Arne
>>>>>>
>>>>>
>>>>> I'm amused every time the GoTo bashing begins.
>>>>>
>>>>> Not only is there nothing wrong when using a branch operation, when
>>>>> appropriate, just look at the assembler listings after
>>>>> compilation.  Branching
>>>>> is just about all assembler does, as required.
>>>>>
>>>>> Now, I won't defend what I and most consider improper use of the poor
>>>>> misunderstood GoTo statement.
>>>>>
>>>>
>>>> But unless used very carefully, it can create horrible spaghetti
>>>> like code, and
>>>> is also easy to screw up.
>>>>
>>>> Using proper structured constructs is much better - easier to read
>>>> as well,
>>>> hence better maintainability.
>>>>
>>>>
>>>
>>> Prey tell, what structured construct will perform cleanup and exit?
>>> I always
>>> expected a return from routines and such.
>>>
>>
>> It would depend on what is needing to be done
>>
>
> Final cleanup, if required, and exit the program.
>
> Knew a guy that would us a gosub to go to the END statement.  Drove me
> nuts.
>

We always used global error handling, as well as local when error...

At least with DEC Basic, it always handled garbage collection

--
Chris

Re: BASIC (and Horizon)

<upeokq$1o97f$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33123&group=comp.os.vms#33123

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arne@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 19:29:14 -0500
Organization: A noiseless patient Spider
Lines: 127
Message-ID: <upeokq$1o97f$1@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <20240131155230.00000457@yahoo.com>
<upee11$1mjib$7@dont-email.me> <upegdc$1n0je$1@dont-email.me>
<upeklu$1nil8$7@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 1 Feb 2024 00:29:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6ffdf96039c0973aca43529b823416a0";
logging-data="1844463"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dzn4yXeci2rF6FxynkXkBW1BFbUYVpvo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:kpsk9ORWW6n82idMlk9cIlVWGtw=
Content-Language: en-US
In-Reply-To: <upeklu$1nil8$7@dont-email.me>
 by: Arne Vajhøj - Thu, 1 Feb 2024 00:29 UTC

On 1/31/2024 6:21 PM, Lawrence D'Oliveiro wrote:
> On Wed, 31 Jan 2024 17:08:44 -0500, Arne Vajhøj wrote:
>
>> On 1/31/2024 4:28 PM, Lawrence D'Oliveiro wrote:
>>
>>> I have never written a goto in C code (not production code, anyway). These
>>> days, you need to do so much dynamic allocation, there is nearly always
>>> some need for cleanup when exiting an inner block anyway, so you can’t
>>> just jump directly somewhere else first. The overall pattern looks like
>>> this:
>>>
>>> MyPtr obj = NULL;
>>> do /*once*/
>>> {
>>> ... possible other stuff ...
>>> «allocate memory for obj»;
>>> if («error occurred»)
>>> break;
>>> ... possible other stuff using obj ...
>>> }
>>> while (false);
>>> free(obj);
>>>
>>> You can confirm, just by inspection, that there is no path out of the
>>> block that does not pass through the free() call precisely once.
>>
>> And the difference compared to:
>>
>> MyPtr obj = NULL;
>> ... possible other stuff ...
>> «allocate memory for obj»;
>> if («error occurred»)
>> goto lbl_freeobj;
>> ... possible other stuff using obj ...
>> lbl_freeobj:
>> free(obj);
>>
>> are?
>
> Nesting.

Goto work fine with nested loops. In fact it is one of the cases
where it really makes sense.

> Try to scale up to something like
>
> static PyObject * discipline_makedict
> (
> PyObject * self,
> PyObject * args
> )
> {
> PyObject * result = NULL;
> PyObject * tempresult = NULL;
> br_PyObject * items;
> const br_char * msg = NULL;
> do /*once*/
> {
> const bool parsed_ok = PyArg_ParseTuple(args, "Os", &items, &msg);
> if (not parsed_ok)
> break;
> fprintf(stdout, "makedict says: “%s”\n", msg);
> if (not PyTuple_Check(items))
> {
> PyErr_SetString(PyExc_TypeError, "expecting a tuple");
> break;
> } /*if*/
> const ssize_t nr_items = PyTuple_Size(items);
> if (PyErr_Occurred())
> break;
> tempresult = PyDict_New();
> if (tempresult == NULL)
> break;
> for (ssize_t i = 0;;)
> {
> if (i == nr_items)
> break;
> br_PyObject * const item = PyTuple_GetItem(items, i);
> if (item == NULL)
> break;
> if (not PyTuple_Check(item) or PyTuple_Size(item) != 2)
> {
> PyErr_SetString(PyExc_TypeError, "expecting a 2-tuple");
> break;
> } /*if*/
> br_PyObject * const first = PyTuple_GetItem(item, 0);
> if (first == NULL)
> break;
> br_PyObject * const second = PyTuple_GetItem(item, 1);
> if (second == NULL)
> break;
> if (first == (PyObject *)&ExceptMe_type or second == (PyObject *)&ExceptMe_type)
> {
> PyErr_SetString(PyExc_ValueError, "ExceptMe object found");
> break;
> } /*if*/
> if (PyDict_SetItem(tempresult, first, second) < 0)
> break;
> ++i;
> } /*for*/
> if (PyErr_Occurred())
> break;
> /* all done */
> result = tempresult;
> tempresult = NULL; /* so I don’t dispose of it yet */
> }
> while (false);
> Py_XDECREF(tempresult);
> return
> result;
> } /*discipline_makedict*/

That code would look a lot cleaner if the do while(false) loop got
removed and the relevant breaks got replaced by goto's.

A well named goto label is much more informative than a plain break.

> More details here
> <https://gitlab.com/ldo/a_structured_discipline_of_programming/>.

Truly bad design.

All the code examples would look better with the do while(false) loops
removed and appropriate goto's.

Arne

Re: BASIC (and Horizon)

<upepeb$1ofg2$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33124&group=comp.os.vms#33124

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arne@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 19:42:50 -0500
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <upepeb$1ofg2$1@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <updog4$1itf7$1@dont-email.me>
<upedpu$1mjib$6@dont-email.me> <upegm7$1n0je$2@dont-email.me>
<upekfj$1nil8$6@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 1 Feb 2024 00:42:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6ffdf96039c0973aca43529b823416a0";
logging-data="1850882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2kuHfchvy+hTJTcohHN7Wtg9v97qb6/k="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:eFCgzXJHSIOpbzGhCA10AJmlhFk=
Content-Language: en-US
In-Reply-To: <upekfj$1nil8$6@dont-email.me>
 by: Arne Vajhøj - Thu, 1 Feb 2024 00:42 UTC

On 1/31/2024 6:18 PM, Lawrence D'Oliveiro wrote:
> On Wed, 31 Jan 2024 17:13:26 -0500, Arne Vajhøj wrote:
>
>> On 1/31/2024 4:24 PM, Lawrence D'Oliveiro wrote:
>>
>>> On Wed, 31 Jan 2024 10:20:35 -0500, Arne Vajhøj wrote:
>>>
>>>> For the not VB.NET knowledgable:
>>>>
>>>> Using o1 As New X("A")
>>>> ...
>>>> End Using
>>>>
>>>> calls o1.Dispose() when the block is exited no matter how it is exited -
>>>> normal or exception does not matter Dispose is always called.
>>>
>>> Python has “context managers” which are a generalization of this. It also
>>> has “try/finally” blocks, which are good for one-off cases.
>>
>> C# was born with using (2002), Python got with in 2.5 (2006)
>> and Java got try with resource in 1.7 (2011).
>>
>> MS got a good idea and the rest copied it.
>
> That is also true of async/await. But note that Python is the only one
> of the three that tries to use reference-counting as an alternative to
> garbage collection.

All of them use garbage collection.

Java and C# use tracing garbage collection.

Python use both tracing garbage collection and reference
counting garbage collection. Or more precisely the common
implementation CPython does - there are other Python
implementations that use only tracing garbage collection.

> And now it looks like C# might be shuffling off into those retirement
> pastures
> <https://www.theregister.com/2024/01/31/microsoft_seeks_rust_developers/>.

Very interesting for Rust, but not particular important for C#.

C# is primarily for business applications.

That Microsoft will rewrite some platform software supporting
moving data within Office 365 in Azure from C# to Rust does
not indicate the end of C#.

I would consider it more negative for Go. Go is big in that
type of cloud and/or container platform software, so MS not
picking Go may indicate something.

Arne

Re: BASIC (and Horizon)

<upervk$oam$1@reader1.panix.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33125&group=comp.os.vms#33125

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 1 Feb 2024 01:26:12 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <upervk$oam$1@reader1.panix.com>
References: <up8qmo$ima5$1@dont-email.me> <upee11$1mjib$7@dont-email.me> <upegdc$1n0je$1@dont-email.me> <upejl0$1nkl5$1@dont-email.me>
Injection-Date: Thu, 1 Feb 2024 01:26:12 -0000 (UTC)
Injection-Info: reader1.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="24918"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
 by: Dan Cross - Thu, 1 Feb 2024 01:26 UTC

In article <upejl0$1nkl5$1@dont-email.me>,
Dave Froble <davef@tsoft-inc.com> wrote:
>I've seen code that did all kinds of confusing things, just avoid a GoTo branch.
> My question is, why? If the need is a simple and rather easy to understand
>branch, why get complex,

`goto` by itself is a sharp tool; sometimes incredibly useful,
but dangerous if misused. Our industry is littered with example
after example of `goto` misused. For instance,
https://dwheeler.com/essays/apple-goto-fail.html

Because of the potential and history of misuse, it's a laudable
goal to reduce use of `goto`, and indeed, over the years we've
seen generations of languages where the primary use cases have
been analyzed and the most useful lifted into new constructs
that become first-class parts of their respective languages;
`break` and `continue` for loops, exceptions, and so on.

Moreover, this is useful in the sense that programming languages
also serve a communicative purpose. How many of us would change
a `for` loop to if's and gotos given the choice? I wager few
would; the former communicates intent far more clearly than the
latter. For that matter, if we could iterate over a collection,
that's even better again.

That said, `goto` obviously _does_ have a place when used
judiciously. As Ken Thompson once said, "if you want to go
somewhere, goto is the best way to get there." Like all goals,
the desire to reduce `goto` prevelence is mostly aspirational.
Certainly, we're well past the context of Djikstra's "GO TO
STATEMENT CONSIDERED HARMFUL" CACM letter.

- Dan C.

Re: BASIC (and Horizon)

<upetth$14m$1@reader1.panix.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33126&group=comp.os.vms#33126

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 1 Feb 2024 01:59:13 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <upetth$14m$1@reader1.panix.com>
References: <up8qmo$ima5$1@dont-email.me> <upegdc$1n0je$1@dont-email.me> <upeklu$1nil8$7@dont-email.me> <upeokq$1o97f$1@dont-email.me>
Injection-Date: Thu, 1 Feb 2024 01:59:13 -0000 (UTC)
Injection-Info: reader1.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="1174"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
 by: Dan Cross - Thu, 1 Feb 2024 01:59 UTC

In article <upeokq$1o97f$1@dont-email.me>,
Arne Vajhøj <arne@vajhoej.dk> wrote:
>On 1/31/2024 6:21 PM, Lawrence D'Oliveiro wrote:
>> On Wed, 31 Jan 2024 17:08:44 -0500, Arne Vajhøj wrote:
>>> On 1/31/2024 4:28 PM, Lawrence D'Oliveiro wrote:
>>[snip]
>> Nesting.
>
>Goto work fine with nested loops. In fact it is one of the cases
>where it really makes sense.

I think the troll was referring to nested control structures,
with nested resource handling.

>> Try to scale up to something like
>>
>> static PyObject * discipline_makedict
>> (
>> PyObject * self,
>> PyObject * args
>> )
>> {
>> PyObject * result = NULL;
>> PyObject * tempresult = NULL;
>> br_PyObject * items;
>> const br_char * msg = NULL;
>> do /*once*/
>> {
>> const bool parsed_ok = PyArg_ParseTuple(args, "Os", &items, &msg);
>> if (not parsed_ok)
>> break;
>> fprintf(stdout, "makedict says: “%s”\n", msg);
>> if (not PyTuple_Check(items))
>> {
>> PyErr_SetString(PyExc_TypeError, "expecting a tuple");
>> break;
>> } /*if*/
>> const ssize_t nr_items = PyTuple_Size(items);
>> if (PyErr_Occurred())
>> break;
>> tempresult = PyDict_New();
>> if (tempresult == NULL)
>> break;
>> for (ssize_t i = 0;;)
>> {
>> if (i == nr_items)
>> break;
>> br_PyObject * const item = PyTuple_GetItem(items, i);
>> if (item == NULL)
>> break;
>> if (not PyTuple_Check(item) or PyTuple_Size(item) != 2)
>> {
>> PyErr_SetString(PyExc_TypeError, "expecting a 2-tuple");
>> break;
>> } /*if*/
>> br_PyObject * const first = PyTuple_GetItem(item, 0);
>> if (first == NULL)
>> break;
>> br_PyObject * const second = PyTuple_GetItem(item, 1);
>> if (second == NULL)
>> break;
>> if (first == (PyObject *)&ExceptMe_type or second == (PyObject *)&ExceptMe_type)
>> {
>> PyErr_SetString(PyExc_ValueError, "ExceptMe object found");
>> break;
>> } /*if*/
>> if (PyDict_SetItem(tempresult, first, second) < 0)
>> break;
>> ++i;
>> } /*for*/
>> if (PyErr_Occurred())
>> break;
>> /* all done */
>> result = tempresult;
>> tempresult = NULL; /* so I don’t dispose of it yet */
>> }
>> while (false);
>> Py_XDECREF(tempresult);
>> return
>> result;
>> } /*discipline_makedict*/
>
>That code would look a lot cleaner if the do while(false) loop got
>removed and the relevant breaks got replaced by goto's.

I almost agree. That could is borderline unreadable, but if one
detangles it from the weird web of style its obfuscated by, one
realizes it can be written in a far more straight-forward manner
without either `goto` or the weird do/while style. Near as I
can tell, the following rough cut is equivalent to the original:

static PyObject *
discipline_makedict(PyObject *self, PyObject *args)
{ br_PyObject *items;
const br_char *msg = NULL;

const bool parsed_ok = PyArg_ParseTuple(args, "Os", &items, &msg);
if (!parsed_ok)
return NULL;

printf("makedict says: \xe2\x80\x9c%s\xe2\x80\x9d\n", msg);
if (!PyTuple_Check(items)) {
PyErr_SetString(PyExc_TypeError, "expecting a tuple");
return NULL;
}
const ssize_t nitems = PyTuple_Size(items);
if (PyErr_Occurred())
return NULL;

PyObject *result = PyDict_New();
if (result == NULL)
return NULL;

for (ssize_t i = 0; i < nitems; ++i) {
br_PyObject *const item = PyTuple_GetItem(items, i);
if (item == NULL)
break;
if (!PyTuple_Check(item) || PyTuple_Size(item) != 2) {
PyErr_SetString(PyExc_TypeError, "expecting a 2-tuple");
break;
}
br_PyObject *const first = PyTuple_GetItem(item, 0);
if (first == NULL)
break;
br_PyObject *const second = PyTuple_GetItem(item, 1);
if (second == NULL)
break;
if (first == (PyObject *)&ExceptMe_type || second == (PyObject *)&ExceptMe_type) {
PyErr_SetString(PyExc_ValueError, "ExceptMe object found");
break;
}
if (PyDict_SetItem(result, first, second) < 0)
break;
}

if (PyErr_Occurred()) {
Py_XDECREF(result);
return NULL;
}

return result;
}

I would argue this is more idiomatic, shorter, simpler, easier
to both read and to reason about, and uses fewer variables.

I couldn't really figure out why the `printf` was in there, so I
left it in; it looks like debugging code though. I didn't test
it, however, since I don't really care.

>A well named goto label is much more informative than a plain break.

Agreed. In this case, the breaks are sufficiently contained
once the rest of the cruft is cut away that I don't think a goto
is any better.

>> More details here
>> <https://gitlab.com/ldo/a_structured_discipline_of_programming/>.
>
>Truly bad design.
>
>All the code examples would look better with the do while(false) loops
>removed and appropriate goto's.

Agreed. That code is straight garbage, and should not make it
past any serious review.

- Dan C.

Re: BASIC (and Horizon)

<upf0r9$1t7cn$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33127&group=comp.os.vms#33127

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 1 Feb 2024 02:49:13 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <upf0r9$1t7cn$1@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <20240131155230.00000457@yahoo.com>
<upee11$1mjib$7@dont-email.me> <upegdc$1n0je$1@dont-email.me>
<upeklu$1nil8$7@dont-email.me> <upeokq$1o97f$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 1 Feb 2024 02:49:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="292505b1016833b26c02e42290db7d4f";
logging-data="2006423"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ntkmZd+mUnaBpAj0doo4d"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:5yekgiiJk9nBnnozy0uOqdJhACc=
 by: Lawrence D'Oliv - Thu, 1 Feb 2024 02:49 UTC

On Wed, 31 Jan 2024 19:29:14 -0500, Arne Vajhøj wrote:

> That code would look a lot cleaner if the do while(false) loop got
> removed and the relevant breaks got replaced by goto's.

Show us how you would do it. I can take you through my code step by step,
block by block, if that will help.

Re: BASIC (and Horizon)

<upf0u1$1t7cn$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33128&group=comp.os.vms#33128

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 1 Feb 2024 02:50:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <upf0u1$1t7cn$2@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <updog4$1itf7$1@dont-email.me>
<upedpu$1mjib$6@dont-email.me> <upegm7$1n0je$2@dont-email.me>
<upekfj$1nil8$6@dont-email.me> <upepeb$1ofg2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 1 Feb 2024 02:50:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="292505b1016833b26c02e42290db7d4f";
logging-data="2006423"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3mSNpWOkNSqlqlT/9pKnp"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:9Gbss2xgClxaq4QVwPjMozSk/Kc=
 by: Lawrence D'Oliv - Thu, 1 Feb 2024 02:50 UTC

On Wed, 31 Jan 2024 19:42:50 -0500, Arne Vajhøj wrote:

> C# is primarily for business applications.

Never heard of it being used for anything important. For example,
Microsoft would never use it itself in Office.

Re: BASIC (and Horizon)

<upf4q6$1tp4r$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33129&group=comp.os.vms#33129

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: davef@tsoft-inc.com (Dave Froble)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 22:57:47 -0500
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <upf4q6$1tp4r$1@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <upee11$1mjib$7@dont-email.me>
<upegdc$1n0je$1@dont-email.me> <upejl0$1nkl5$1@dont-email.me>
<upervk$oam$1@reader1.panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 1 Feb 2024 03:56:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="67ae6c41f7b9c5cf3283faf444e1f5ca";
logging-data="2024603"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4lxdgZ6GF8Uo62objv7e4ptZPB352xe0="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:3SIMCUZh0vAUmzmctUjZi2K1W6U=
In-Reply-To: <upervk$oam$1@reader1.panix.com>
 by: Dave Froble - Thu, 1 Feb 2024 03:57 UTC

On 1/31/2024 8:26 PM, Dan Cross wrote:
> In article <upejl0$1nkl5$1@dont-email.me>,
> Dave Froble <davef@tsoft-inc.com> wrote:
>> I've seen code that did all kinds of confusing things, just avoid a GoTo branch.
>> My question is, why? If the need is a simple and rather easy to understand
>> branch, why get complex,
>
> `goto` by itself is a sharp tool; sometimes incredibly useful,
> but dangerous if misused. Our industry is littered with example
> after example of `goto` misused. For instance,
> https://dwheeler.com/essays/apple-goto-fail.html

Cars are dangerous, should we go back to horses?
Horses are dangerous, should we go back to walking?
Walking is dangerous ...

Flying is dangerous ...
Boats are dangerous ...

Crossing the street is dangerous. But we're taught to look before stepping in
front of the bus.

GoTo can be dangerous ...
Learn good programming habits ...

>
> That said, `goto` obviously _does_ have a place when used
> judiciously.

Yes, that ...

--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486

Re: BASIC (and Horizon)

<upf4ve$1tp4r$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33130&group=comp.os.vms#33130

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!news.chmurka.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: davef@tsoft-inc.com (Dave Froble)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Wed, 31 Jan 2024 23:00:35 -0500
Organization: A noiseless patient Spider
Lines: 138
Message-ID: <upf4ve$1tp4r$2@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <up9eho$lqco$2@dont-email.me>
<up9h57$fmh$1@panix1.panix.com> <up9hra$m85k$1@dont-email.me>
<upa74a$t0ce$1@dont-email.me> <upb1p2$10mt0$1@dont-email.me>
<upci9g$1cmn1$2@dont-email.me> <20240131155230.00000457@yahoo.com>
<upee11$1mjib$7@dont-email.me> <upegdc$1n0je$1@dont-email.me>
<upeklu$1nil8$7@dont-email.me> <upeokq$1o97f$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 1 Feb 2024 03:59:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="67ae6c41f7b9c5cf3283faf444e1f5ca";
logging-data="2024603"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/y5elUM6fBPXq8Dyx2ZEitahxdeqSmqjQ="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:S3M2m5KEDdTVoqdjqDypyqlnclc=
In-Reply-To: <upeokq$1o97f$1@dont-email.me>
 by: Dave Froble - Thu, 1 Feb 2024 04:00 UTC

On 1/31/2024 7:29 PM, Arne Vajhøj wrote:
> On 1/31/2024 6:21 PM, Lawrence D'Oliveiro wrote:
>> On Wed, 31 Jan 2024 17:08:44 -0500, Arne Vajhøj wrote:
>>
>>> On 1/31/2024 4:28 PM, Lawrence D'Oliveiro wrote:
>>>
>>>> I have never written a goto in C code (not production code, anyway). These
>>>> days, you need to do so much dynamic allocation, there is nearly always
>>>> some need for cleanup when exiting an inner block anyway, so you can’t
>>>> just jump directly somewhere else first. The overall pattern looks like
>>>> this:
>>>>
>>>> MyPtr obj = NULL;
>>>> do /*once*/
>>>> {
>>>> ... possible other stuff ...
>>>> «allocate memory for obj»;
>>>> if («error occurred»)
>>>> break;
>>>> ... possible other stuff using obj ...
>>>> }
>>>> while (false);
>>>> free(obj);
>>>>
>>>> You can confirm, just by inspection, that there is no path out of the
>>>> block that does not pass through the free() call precisely once.
>>>
>>> And the difference compared to:
>>>
>>> MyPtr obj = NULL;
>>> ... possible other stuff ...
>>> «allocate memory for obj»;
>>> if («error occurred»)
>>> goto lbl_freeobj;
>>> ... possible other stuff using obj ...
>>> lbl_freeobj:
>>> free(obj);
>>>
>>> are?
>>
>> Nesting.
>
> Goto work fine with nested loops. In fact it is one of the cases
> where it really makes sense.
>
>> Try to scale up to something like
>>
>> static PyObject * discipline_makedict
>> (
>> PyObject * self,
>> PyObject * args
>> )
>> {
>> PyObject * result = NULL;
>> PyObject * tempresult = NULL;
>> br_PyObject * items;
>> const br_char * msg = NULL;
>> do /*once*/
>> {
>> const bool parsed_ok = PyArg_ParseTuple(args, "Os", &items, &msg);
>> if (not parsed_ok)
>> break;
>> fprintf(stdout, "makedict says: “%s”\n", msg);
>> if (not PyTuple_Check(items))
>> {
>> PyErr_SetString(PyExc_TypeError, "expecting a tuple");
>> break;
>> } /*if*/
>> const ssize_t nr_items = PyTuple_Size(items);
>> if (PyErr_Occurred())
>> break;
>> tempresult = PyDict_New();
>> if (tempresult == NULL)
>> break;
>> for (ssize_t i = 0;;)
>> {
>> if (i == nr_items)
>> break;
>> br_PyObject * const item = PyTuple_GetItem(items, i);
>> if (item == NULL)
>> break;
>> if (not PyTuple_Check(item) or PyTuple_Size(item) != 2)
>> {
>> PyErr_SetString(PyExc_TypeError, "expecting a 2-tuple");
>> break;
>> } /*if*/
>> br_PyObject * const first = PyTuple_GetItem(item, 0);
>> if (first == NULL)
>> break;
>> br_PyObject * const second = PyTuple_GetItem(item, 1);
>> if (second == NULL)
>> break;
>> if (first == (PyObject *)&ExceptMe_type or second == (PyObject
>> *)&ExceptMe_type)
>> {
>> PyErr_SetString(PyExc_ValueError, "ExceptMe object found");
>> break;
>> } /*if*/
>> if (PyDict_SetItem(tempresult, first, second) < 0)
>> break;
>> ++i;
>> } /*for*/
>> if (PyErr_Occurred())
>> break;
>> /* all done */
>> result = tempresult;
>> tempresult = NULL; /* so I don’t dispose of it yet */
>> }
>> while (false);
>> Py_XDECREF(tempresult);
>> return
>> result;
>> } /*discipline_makedict*/
>
> That code would look a lot cleaner if the do while(false) loop got
> removed and the relevant breaks got replaced by goto's.
>
> A well named goto label is much more informative than a plain break.
>
>> More details here
>> <https://gitlab.com/ldo/a_structured_discipline_of_programming/>.
>
> Truly bad design.
>
> All the code examples would look better with the do while(false) loops
> removed and appropriate goto's.
>
> Arne
>

It's called do whatever to avoid a goto, and it can be very bad ...

--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486

Re: BASIC (and Horizon)

<3c16a3a0f6100e01b49cf3de3d3411f051b23cab.camel@munted.eu>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33131&group=comp.os.vms#33131

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!news.niel.me!news.gegeweb.eu!gegeweb.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: alex.buell@munted.eu (Single Stage to Orbit)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 01 Feb 2024 08:43:12 +0000
Organization: One very high maintenance cat
Lines: 9
Message-ID: <3c16a3a0f6100e01b49cf3de3d3411f051b23cab.camel@munted.eu>
References: <up8qmo$ima5$1@dont-email.me> <upee11$1mjib$7@dont-email.me>
<upegdc$1n0je$1@dont-email.me> <upejl0$1nkl5$1@dont-email.me>
<upervk$oam$1@reader1.panix.com> <upf4q6$1tp4r$1@dont-email.me>
Reply-To: alex.buell@munted.eu
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: dont-email.me; posting-host="9240d62dce17e12fc7ea795d342fec6e";
logging-data="2107283"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JmPlRgO/79sdGlwAB6V+nQglMHK+9PBM="
User-Agent: Evolution 3.50.2
Cancel-Lock: sha1:idCOlDaHArK5Tu/4pmeojrhIqwk=
In-Reply-To: <upf4q6$1tp4r$1@dont-email.me>
Autocrypt: addr=alex.buell@munted.eu; prefer-encrypt=mutual;
keydata=mQGiBESBdzQRBADZG8wvppAgI8NwvsAxedwBtLw7q6JjAisK91A7pF7zNpHtEHQhN4blBelLYHE48l12D2HzmMM+ZsI7cMCT/iOo1HdvWILoyg5nLNh2owaRYspg4DZRee4KefYrhyEl96THy19VK09sXAe42tmtZJNo+OJ+0lkPEapStyIlSJrHiwCggm70g64yVDu+47pBXvfLn8tifbsEALbT65XgZPETlJ7GWJAI82X/ZlaUx7EOMXKxX2LzWFJEadbHXsKi3zlKuneNGU8pwQNHVXN0wfHi/kRw5f4TrButZl4kDK8h3sP27awLWXHPCTfJXEOzihvmBdX23JcvXMWmGwI+5nzlSUj5jXRj8QFRxGrwbGEK1yHms/ja9cbDA/9+AOrHttUrvRSovBrt0XGCTxjBswtTnpZjfCJv8RdvAWfhaGxf7gz7kAlNRnQI4N8Uv0QT8uPy6ZHdabyPW/8WsOxdWXwLcfExDvx8PGzn2Z6z6mjV9ziVp2xco0nzs7wneHqnzSgZLgoFg3Yy49MpDJwGEfQnANjnAhonW9z+x7Q7QWxleCBCdWVsbCAoTWFpbiBFLW1haWwgQWRkcmVzcykgPGFsZXguYnVlbGxAbXVudGVkLm9yZy51az6IXwQTEQIAIAIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheABQJTXnyNAAoJEBP0zXMUgl+OIdUAnRLVsqLvC2OcDnSl0AqFqLnuX+MmAJjf5M0x826cEjl7zw1YyDhgn7qdtCFBbGV4IEJ1ZWxsIDxhbGV4LmJ1ZWxsQG11bnRlZC5ldT6IZgQTEQIAJgIbAwcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheABQJTXnyNAhkBAAoJEBP0zXMUgl+O+RoAnj1uoAheC30ecr4yoh6avHEhL/llAJ9Qo1iwHVMpXRRhK+cHvRXKpfrK57kEDQREgXnxEBAAySb93hrH28AtA5sPE
pwF+Chy+xK5KISe4f7HJQpwWNgPCFJVFfldNUJdk2skCeFlmHCn81fzVx1tewE0xx6nsqPgBugjIukmY/14jp4ysr6g+xqxMhdQqW1gPPssuztn8GEk5c/nLr3R3uZYoeLNxWxGOm0agpepMeMduFHcVQWqZ2UwgOcg1ytPtedAzyyQzbNuxENIPj/SF9jCPoqZJlN8eh3p8m2HuWp317YA8bUD/f+wJDvqADraxjXr2Nq0YRdgTr/+ajQdHJx+j4jUary0FM2C9I9jlljdb776uYr5qo4Ame9I11f+/g3IiZcIejRDqd5P41JjzzEX+f5wLpqvdHC/i8940bbhE2wi+Gh+cTOX25x6zRtb0uxzPsaLhCdOAEcZvuK8afKyNo0/Ptgpc/qO5p+EdY4mX7KIrbCKADobzlO9Ny+dSaY7/IGJIXASjPunQlBsMRWixzEe6I/zKUAmjCEW1La9nOmY/9r37rfY0yRS5HdDzZLrZQz4UdtdK7mkfFAPpdT0BIRoVYo8VbtPwgqCAm3h7lcbEjSmmzzxBcp35jQmTkJl4yszgYG1c+IQ+YSeqmMbdqdKaSMU3fq0agCJGvQzOAzSEt2wClXBzqBU0lH7/rfLh5khk/BGYLbCFRkNypZdcbi+Dim7asXgEvkkwfyySbmux7MAAwUP/2cja0PGvAfwr3Z+LifcVZa+b/Zn4Ro+FxgJ3TKwWk8i9L5j4xPErwDTucnhEAoBtv79wfFlpo/iKUuMy4Jcs/d6iWz+8TFQRHB3xzPZqAYvMxN9bzlIwSVnwrvi2ocnwiZZqA/KZo+a9i1Q0R/1I19fwXQtuYEW0dWyqdxS4NdUUIujEf9sefUiRVhDXe3ra2g7W2oOmRJJ3kDGZpM8wKNIwyQeHlVjuPVdwEOyp8xCZqPIAWTWl6CdcLi1m5sO0+BRQjCqkv8wdQODgheQ3qeHRQdrag57tSJ3rtmnvQgz2/Ref4q2mk478/fHtskGyPauhn
oM21NnHfo7RohDWVnYxAbHrErJjrym5yRxgWN0ccrsoeza/8m+G+my78KFVUtoTn9QmDDtaHrp7I2XGZ4r8rpvtCBxg4IFUqHg0ESI2/4pHw8n4uyD9e7yuZ+0zsLzMhloNEZ8ABe2/peVeir9eEVGqXTmixiLgVvPkTBi6xa4FmTqG3m0woUz8BXzCT1hoHtTPQ4UxGgcp8ITPUy1dJKUsqqY1uPSuLA06tGPQj7w/0j1HTuyct5NNHFDpDvrQdi/qr4CEk3WVWAEiv+d07DumSKnb6k5OySXSK128/oE2FXKsM1gNgFpK2SqEqfylxpAtJmRWNcV7Dyaqci22xRgBnU9X5iC2N9eXvaliEkEGBECAAkFAkSBefECGwwACgkQE/TNcxSCX46DQQCdH57pYA1kE373R9WsUN6+OXpqD8gAn0oKFduLKG48YhT7256Jo/7ZDeSU
 by: Single Stage to Orbi - Thu, 1 Feb 2024 08:43 UTC

On Wed, 2024-01-31 at 22:57 -0500, Dave Froble wrote:
>
> GoTo can be dangerous ...
> Learn good programming habits ...

Linux uses goto in the kernel a lot. Should I throw it in the bin?
--
Tactical Nuclear Kittens

Re: BASIC (and Horizon)

<upg4lv$f15$1@reader1.panix.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33132&group=comp.os.vms#33132

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 1 Feb 2024 13:00:47 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <upg4lv$f15$1@reader1.panix.com>
References: <up8qmo$ima5$1@dont-email.me> <upejl0$1nkl5$1@dont-email.me> <upervk$oam$1@reader1.panix.com> <upf4q6$1tp4r$1@dont-email.me>
Injection-Date: Thu, 1 Feb 2024 13:00:47 -0000 (UTC)
Injection-Info: reader1.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="15397"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
 by: Dan Cross - Thu, 1 Feb 2024 13:00 UTC

In article <upf4q6$1tp4r$1@dont-email.me>,
Dave Froble <davef@tsoft-inc.com> wrote:
>On 1/31/2024 8:26 PM, Dan Cross wrote:
>> In article <upejl0$1nkl5$1@dont-email.me>,
>> Dave Froble <davef@tsoft-inc.com> wrote:
>>> I've seen code that did all kinds of confusing things, just avoid a GoTo branch.
>>> My question is, why? If the need is a simple and rather easy to understand
>>> branch, why get complex,
>>
>> `goto` by itself is a sharp tool; sometimes incredibly useful,
>> but dangerous if misused. Our industry is littered with example
>> after example of `goto` misused. For instance,
>> https://dwheeler.com/essays/apple-goto-fail.html
>
>Cars are dangerous, should we go back to horses?

I think the analogy is more like, "cars are dangerous, so should
we get rid of seatbelts?" Or, "Takata made dangerous air bags,
so what's the point of having them at all?"

>Horses are dangerous, should we go back to walking?
>Walking is dangerous ...
>
>Flying is dangerous ...
>Boats are dangerous ...
>
>Crossing the street is dangerous. But we're taught to look before stepping in
>front of the bus.
>
>GoTo can be dangerous ...
>Learn good programming habits ...

I wonder if you read the rest of my post which tried, perhaps
imperfectly, to say more or less the same thing.

>> That said, `goto` obviously _does_ have a place when used
>> judiciously.
>
>Yes, that ...

Just so.

- Dan C.

Re: BASIC (and Horizon)

<upg4sd$o4f$1@reader1.panix.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33133&group=comp.os.vms#33133

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 1 Feb 2024 13:04:13 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <upg4sd$o4f$1@reader1.panix.com>
References: <up8qmo$ima5$1@dont-email.me> <upervk$oam$1@reader1.panix.com> <upf4q6$1tp4r$1@dont-email.me> <3c16a3a0f6100e01b49cf3de3d3411f051b23cab.camel@munted.eu>
Injection-Date: Thu, 1 Feb 2024 13:04:13 -0000 (UTC)
Injection-Info: reader1.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="24719"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
 by: Dan Cross - Thu, 1 Feb 2024 13:04 UTC

In article <3c16a3a0f6100e01b49cf3de3d3411f051b23cab.camel@munted.eu>,
Single Stage to Orbit <alex.buell@munted.eu> wrote:
>On Wed, 2024-01-31 at 22:57 -0500, Dave Froble wrote:
>>
>> GoTo can be dangerous ...
>> Learn good programming habits ...
>
>Linux uses goto in the kernel a lot. Should I throw it in the bin?

I see the point has gone over multiple people's heads, which
probably means I did a poor job explaining. Like I said, `goto`
*can* be useful. Does that mean we should use it in lieu of
structued constructs like loops, when available? No.

It's silly to deny that `goto` has been abused, leading to lots
of very poor code. This is and was well-known. Rising to the
defense of `goto` without acknowledging its faults is similarly
silly.

- Dan C.

Re: BASIC (and Horizon)

<upg5n7$o5v$1@reader1.panix.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33135&group=comp.os.vms#33135

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 1 Feb 2024 13:18:31 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <upg5n7$o5v$1@reader1.panix.com>
References: <up8qmo$ima5$1@dont-email.me> <upeklu$1nil8$7@dont-email.me> <upeokq$1o97f$1@dont-email.me> <upf0r9$1t7cn$1@dont-email.me>
Injection-Date: Thu, 1 Feb 2024 13:18:31 -0000 (UTC)
Injection-Info: reader1.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="24767"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
 by: Dan Cross - Thu, 1 Feb 2024 13:18 UTC

In article <upf0r9$1t7cn$1@dont-email.me>,
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>On Wed, 31 Jan 2024 19:29:14 -0500, Arne Vajhøj wrote:
>
>> That code would look a lot cleaner if the do while(false) loop got
>> removed and the relevant breaks got replaced by goto's.
>
>Show us how you would do it. I can take you through my code step by step,
>block by block, if that will help.

As I posted in my other message (untested):

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <stdio.h>

static PyObject *
discipline_makedict(PyObject *self, PyObject *args)
{ PyObject *items;
const char *msg = NULL;

const int parsed_ok = PyArg_ParseTuple(args, "Os", &items, &msg);
if (!parsed_ok)
return NULL;

printf("makedict says: \xe2\x80\x9c%s\xe2\x80\x9d\n", msg);
if (!PyTuple_Check(items)) {
PyErr_SetString(PyExc_TypeError, "expecting a tuple");
return NULL;
}
const ssize_t nitems = PyTuple_Size(items);
if (PyErr_Occurred())
return NULL;

PyObject *result = PyDict_New();
if (result == NULL)
return NULL;

for (ssize_t i = 0; i < nitems; ++i) {
PyObject *const item = PyTuple_GetItem(items, i);
if (item == NULL)
break;
if (!PyTuple_Check(item) || PyTuple_Size(item) != 2) {
PyErr_SetString(PyExc_TypeError, "expecting a 2-tuple");
break;
}
PyObject *const first = PyTuple_GetItem(item, 0);
if (first == NULL)
break;
PyObject *const second = PyTuple_GetItem(item, 1);
if (second == NULL)
break;
if (first == (PyObject *)&ExceptMe_type || second == (PyObject *)&ExceptMe_type) {
PyErr_SetString(PyExc_ValueError, "ExceptMe object found");
break;
}
if (PyDict_SetItem(result, first, second) < 0)
break;
}

if (PyErr_Occurred()) {
Py_XDECREF(result);
}

return result;
}

No gotos, no simulated goto-via-early-break in a do/while(false)
loop.

As I said previously, this is more idiomatic, simpler, easier to
reason about, easier to read, and uses fewer variables. Your
initial code was, to be blunt, unreadable and truly awful shit.

- Dan C.

Re: BASIC (and Horizon)

<upg5s6$2346b$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33136&group=comp.os.vms#33136

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: clubley@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 1 Feb 2024 13:21:10 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <upg5s6$2346b$1@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <upegdc$1n0je$1@dont-email.me> <upeklu$1nil8$7@dont-email.me> <upeokq$1o97f$1@dont-email.me> <upetth$14m$1@reader1.panix.com>
Injection-Date: Thu, 1 Feb 2024 13:21:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f31c66d88536f81f9b4370f66dec85a7";
logging-data="2199755"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+thuhfByhpE3cLRbJJyzFLuqv57Dlq35U="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:a5nhAsSPbyc0EECFjwmzHUF8bDE=
 by: Simon Clubley - Thu, 1 Feb 2024 13:21 UTC

On 2024-01-31, Dan Cross <cross@spitfire.i.gajendra.net> wrote:
>
> I would argue this is more idiomatic, shorter, simpler, easier
> to both read and to reason about, and uses fewer variables.
>

I agree and this is the general style I use, but with one difference.
In my code, I always, always, use braces in an if() statement, even
if the conditional code is only a single statement. For example:

const bool parsed_ok = PyArg_ParseTuple(args, "Os", &items, &msg);
if (!parsed_ok)
{
return NULL;
}

I think that makes it more clear and removes any possibility of future
code changes accidentally not adding the braces at that time.

[And yes, about the above indentation, Simon _is_ indeed a Whitesmiths
person. :-)]

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Re: BASIC (and Horizon)

<upg62u$2346b$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=33137&group=comp.os.vms#33137

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: clubley@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: Re: BASIC (and Horizon)
Date: Thu, 1 Feb 2024 13:24:46 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <upg62u$2346b$2@dont-email.me>
References: <up8qmo$ima5$1@dont-email.me> <upee11$1mjib$7@dont-email.me> <upegdc$1n0je$1@dont-email.me> <upejl0$1nkl5$1@dont-email.me> <upervk$oam$1@reader1.panix.com> <upf4q6$1tp4r$1@dont-email.me>
Injection-Date: Thu, 1 Feb 2024 13:24:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f31c66d88536f81f9b4370f66dec85a7";
logging-data="2199755"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gbJ7G6VpLw4DrGPGQRFgGr0fJ2h+f2Hw="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:0EUkGrOGpfEPup5gM6tGpCBvxd0=
 by: Simon Clubley - Thu, 1 Feb 2024 13:24 UTC

On 2024-01-31, Dave Froble <davef@tsoft-inc.com> wrote:
> On 1/31/2024 8:26 PM, Dan Cross wrote:
>> In article <upejl0$1nkl5$1@dont-email.me>,
>> Dave Froble <davef@tsoft-inc.com> wrote:
>>> I've seen code that did all kinds of confusing things, just avoid a GoTo branch.
>>> My question is, why? If the need is a simple and rather easy to understand
>>> branch, why get complex,
>>
>> `goto` by itself is a sharp tool; sometimes incredibly useful,
>> but dangerous if misused. Our industry is littered with example
>> after example of `goto` misused. For instance,
>> https://dwheeler.com/essays/apple-goto-fail.html
>
> Cars are dangerous, should we go back to horses?

No, but we introduced safety measures based on experience.

> Horses are dangerous, should we go back to walking?

No, but we introduced safety measures based on experience.

> Walking is dangerous ...

We introduced safety measures based on experience (depending on
the type of walking you are doing).

>
> Flying is dangerous ...

We introduced safety measures based on experience.

> Boats are dangerous ...

We introduced safety measures based on experience.

>
> GoTo can be dangerous ...
> Learn good programming habits ...
>

We introduced safer alternatives based on experience.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.


computers / comp.os.vms / Re: BASIC (and Horizon)

Pages:1234
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor