Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Many pages make a thick book, except for pocket Bibles which are on very very thin paper.


comp / comp.os.linux.misc / Re: Joy of this, Joy of that

SubjectAuthor
* Joy of this, Joy of thatroot
+* Re: Joy of this, Joy of thatLawrence D'Oliveiro
|`* Re: Joy of this, Joy of thatroot
| +- Re: Joy of this, Joy of thatLawrence D'Oliveiro
| `- Re: Joy of this, Joy of thatrbowman
`* Re: Joy of this, Joy of that186282@ud0s4.net
 +* Re: Joy of this, Joy of thatRich
 |+- Re: Joy of this, Joy of thatThe Natural Philosopher
 |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | +* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |`- Re: Joy of this, Joy of thatBozo User
 | +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |`* Re: Joy of this, Joy of thatDon_from_AZ
 | | `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |  `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |   +* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |   |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |   | +* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |   | |`- Re: Joy of this, Joy of that186282@ud0s4.net
 | |   | `- Re: Joy of this, Joy of thatrbowman
 | |   `* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |    +- Re: Joy of this, Joy of thatrbowman
 | |    +* Re: Joy of this, Joy of thatLouis Krupp
 | |    |`- Re: Joy of this, Joy of thatRich
 | |    +- Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |    `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |     +- Re: Joy of this, Joy of thatrbowman
 | |     `* Re: Joy of this, Joy of thatRich
 | |      +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      |+* Re: Joy of this, Joy of thatRich
 | |      ||`* Re: Joy of this, Joy of thatD
 | |      || `* Re: Joy of this, Joy of thatrbowman
 | |      ||  `* Re: Joy of this, Joy of thatD
 | |      ||   `* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||    +* Re: Joy of this, Joy of thatD
 | |      ||    |`* Re: Joy of this, Joy of thatrbowman
 | |      ||    | +- Re: Joy of this, Joy of thatD
 | |      ||    | `* Re: Joy of this, Joy of thatPancho
 | |      ||    |  `* Re: Joy of this, Joy of thatRich
 | |      ||    |   +* Re: Joy of this, Joy of thatChris Ahlstrom
 | |      ||    |   |`- Re: Joy of this, Joy of thatPancho
 | |      ||    |   `* Re: Joy of this, Joy of thatrbowman
 | |      ||    |    +* Re: Joy of this, Joy of thatD
 | |      ||    |    |+- Re: Joy of this, Joy of thatRich
 | |      ||    |    |`* Re: Joy of this, Joy of thatrbowman
 | |      ||    |    | `- Re: Joy of this, Joy of thatD
 | |      ||    |    `* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||    |     `* Re: Joy of this, Joy of thatrbowman
 | |      ||    |      `- Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||    `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||     `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||      `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||       `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        +* Re: Joy of this, Joy of thatrbowman
 | |      ||        |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        | +* Re: Joy of this, Joy of thatrbowman
 | |      ||        | |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        | | `- Re: Joy of this, Joy of thatrbowman
 | |      ||        | `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        |  `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   +* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   | +- Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        |   | `* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |  +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||        |   |  |`- Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        |   |  `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |   +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||        |   |   |+* Re: Joy of this, Joy of thatRich
 | |      ||        |   |   ||`- Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |   |+- Re: Joy of this, Joy of thatD
 | |      ||        |   |   |`- Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |   +* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        |   |   |`- Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |   `* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |    `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |     +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||        |   |     |`- Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |     `* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |      `* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       +* Re: Joy of this, Joy of thatD
 | |      ||        |   |       |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       | +* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |       | |+* Re: Joy of this, Joy of thatD
 | |      ||        |   |       | ||+* Re: Joy of this, Joy of thatCharlie Gibbs
 | |      ||        |   |       | |||+* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       | ||||`* Re: Joy of this, Joy of thatD
 | |      ||        |   |       | |||| +* Re: Joy of this, Joy of thatRich
 | |      ||        |   |       | |||| |`* Re: Joy of this, Joy of thatD
 | |      ||        |   |       | |||| | `* Re: Joy of this, Joy of thatRich
 | |      ||        |   |       | |||| |  +* Re: Joy of this, Joy of thatCharlie Gibbs
 | |      ||        |   |       | |||| |  |`- Re: Joy of this, Joy of thatD
 | |      ||        |   |       | |||| |  `* Re: Joy of this, Joy of thatD
 | |      ||        |   |       | |||| |   +* Re: Joy of this, Joy of thatRich
 | |      ||        |   |       | |||| |   |+* Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |       | |||| |   ||`* Re: Joy of this, Joy of thatRich
 | |      ||        |   |       | |||| |   || +* Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||        |   |       | |||| |   || |`* Re: Joy of this, Joy of thatCharlie Gibbs
 | |      ||        |   |       | |||| |   || | `- Re: Joy of this, Joy of thatThe Natural Philosopher
 | |      ||        |   |       | |||| |   || +- Re: Joy of this, Joy of thatCharlie Gibbs
 | |      ||        |   |       | |||| |   || `- Re: Joy of this, Joy of thatrbowman
 | |      ||        |   |       | |||| |   |`- Re: Joy of this, Joy of thatD
 | |      ||        |   |       | |||| |   `* Re: Joy of this, Joy of thatRobert Riches
 | |      ||        |   |       | |||| `- Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       | |||`* Re: Joy of this, Joy of thatD
 | |      ||        |   |       | ||`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       | |`* Re: Joy of this, Joy of that186282@ud0s4.net
 | |      ||        |   |       | `* Re: Joy of this, Joy of thatD
 | |      ||        |   |       `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        |   `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      ||        `* Re: Joy of this, Joy of thatLawrence D'Oliveiro
 | |      |`* Re: Joy of this, Joy of thatvallor
 | |      `* Re: Joy of this, Joy of thatD
 | `- Re: Joy of this, Joy of thatRich
 +* Re: Joy of this, Joy of thatJohn Ames
 `- Re: Joy of this, Joy of thatrbowman

Pages:12345678910111213141516171819202122232425262728293031323334
Subject: Re: Joy of this, Joy of that
From: The Natural Philosop
Newsgroups: comp.os.linux.misc
Organization: A little, after lunch
Date: Sat, 23 Nov 2024 11:25 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 11:25:02 +0000
Organization: A little, after lunch
Lines: 21
Message-ID: <vhse2e$1m6qu$4@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me> <vhrbsr$1dqca$2@dont-email.me>
<vhs3ji$1kb5c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 12:25:02 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d66e216f27af22ed0cfed08003360025";
logging-data="1776478"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199xRzF342WT73nNDHuYAsIxz+q4x0LeeU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:PX/gUU5+sLaYPLqz2kz0+96vFrQ=
Content-Language: en-GB
In-Reply-To: <vhs3ji$1kb5c$1@dont-email.me>
View all headers

On 23/11/2024 08:26, Pancho wrote:
> On 11/23/24 01:41, Lawrence D'Oliveiro wrote:

>> I’m pretty sure it has been used commercially, back in the 1980s or
>> so, maybe even the 1990s.
>
> Probably, just as some people program in Haskell or Prolog.
>
It has occasionally. Back in the day when I scanned job adverts 'must be
proficient in smalltalk has been seen.

But the reason why the majority of work was 'experienced in C Unix and
vi' was on the job was because it was positive feedback loop. The more
people used it the more people learnt it in order to maintain and extend it.

--
The lifetime of any political organisation is about three years before
its been subverted by the people it tried to warn you about.

Anon.

Subject: Re: Joy of this, Joy of that
From: The Natural Philosop
Newsgroups: comp.os.linux.misc
Organization: A little, after lunch
Date: Sat, 23 Nov 2024 11:30 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 11:30:59 +0000
Organization: A little, after lunch
Lines: 28
Message-ID: <vhsedj$1m6qu$5@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me> <lqcsvtFiao0U1@mid.individual.net>
<vhs544$1kb5c$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 23 Nov 2024 12:30:59 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d66e216f27af22ed0cfed08003360025";
logging-data="1776478"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+r8+ET0CrCOam3HU/m1tOu2x55ODdCCGE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:p62wd03Ln9M2M45RflDShF0grjA=
In-Reply-To: <vhs544$1kb5c$2@dont-email.me>
Content-Language: en-GB
View all headers

On 23/11/2024 08:52, Pancho wrote:
> I genuinely like OO design. It is the way I naturally think of program
> structure. It maps well to designing service orientated architectures.

Oh, in terms of keeping things that are closely related in the same
place syntactically, its great.

But the syntax so used is weird arcane and occasionally crap.
You don't need C++ to write object oriented code in.

And thereby hangs the problem. Its Yet Another Computer Scientist
creating a language that tries to enforce an approach, rather than
providing tools to make such an approach possible *if you want it*.

far too much stress on the language and none at all on the software
*engineering* approach of problem analysis, decomposition,
documentation, construction of code and subsequent stress testing.

--
I was brought up to believe that you should never give offence if you
can avoid it; the new culture tells us you should always take offence if
you can. There are now experts in the art of taking offence, indeed
whole academic subjects, such as 'gender studies', devoted to it.

Sir Roger Scruton

Subject: Re: Joy of this, Joy of that
From: The Natural Philosop
Newsgroups: comp.os.linux.misc
Organization: A little, after lunch
Date: Sat, 23 Nov 2024 11:31 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 11:31:51 +0000
Organization: A little, after lunch
Lines: 25
Message-ID: <vhsef7$1m6qu$6@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad> <vhs153$1k6ft$3@dont-email.me>
<vhs5tj$1kb5c$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 23 Nov 2024 12:31:52 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d66e216f27af22ed0cfed08003360025";
logging-data="1776478"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195fRSWPV97ITXHiFVGSBoLEe8WpOcSKYY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:UKTOwDvv8uZPOB8KkFcZXgToCQw=
In-Reply-To: <vhs5tj$1kb5c$3@dont-email.me>
Content-Language: en-GB
View all headers

On 23/11/2024 09:05, Pancho wrote:
> On 11/23/24 07:44, Lawrence D'Oliveiro wrote:
>> On Sat, 23 Nov 2024 07:09:06 GMT, Charlie Gibbs wrote:
>>
>>> So it's the good old-fashioned way - free
>>> each allocation one by one and hope you don't forget one.
>>
>> One thing that helps is that free(3) is idempotent:
>
> It isn't idempotent.
>
>> calling it on a NULL
>> pointer is a harmless no-op,
>
> OK it is idempotent on NULL, but not in general.
>
As I discovered to my shame. freeing the same pointer twice is not
harmless.

--
For every complex problem there is an answer that is clear, simple, and
wrong.

H.L.Mencken

Subject: Re: Joy of this, Joy of that
From: The Natural Philosop
Newsgroups: comp.os.linux.misc
Organization: A little, after lunch
Date: Sat, 23 Nov 2024 11:34 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 11:34:08 +0000
Organization: A little, after lunch
Lines: 32
Message-ID: <vhsejh$1m6qu$7@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad> <vhs153$1k6ft$3@dont-email.me>
<wwvjzcu1chd.fsf@LkoBDZeT.terraraq.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 12:34:09 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d66e216f27af22ed0cfed08003360025";
logging-data="1776478"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QpkURqdaSKI7YTV7ZOngR/y6ZXVR82q0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Bt5QHVerncBPMKmMv7TRZfH3NUw=
Content-Language: en-GB
In-Reply-To: <wwvjzcu1chd.fsf@LkoBDZeT.terraraq.uk>
View all headers

On 23/11/2024 10:16, Richard Kettlewell wrote:
> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>> On Sat, 23 Nov 2024 07:09:06 GMT, Charlie Gibbs wrote:
>>> So it's the good old-fashioned way - free
>>> each allocation one by one and hope you don't forget one.
>>
>> One thing that helps is that free(3) is idempotent:
>
> It is not. Freeing the same non-null pointer twice is a bug (and a
> common source of vulnerabilities).
>
>> calling it on a NULL pointer is a harmless no-op, so there is no need
>> to check for NULL before calling it. So my standard technique
>> (simplifying somewhat) is
>
> ‘free() and null out all copies of the pointer that can ever reach
> free() in the future’ is idempotent, if you can get it right (which is
> usually not too hard in a well-organized program).
>
I had to read that three times to understand what you said there.

A comma after the first free() would have helped.:-)

Otherwise +100

--
For every complex problem there is an answer that is clear, simple, and
wrong.

H.L.Mencken

Subject: Re: Joy of this, Joy of that
From: Charlie Gibbs
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 19:16 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!2.eu.feeder.erje.net!feeder.erje.net!news.mb-net.net!open-news-network.org!news.mind.de!bolzen.all.de!npeer.as286.net!npeer-ng0.as286.net!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx03.iad.POSTED!not-for-mail
Newsgroups: comp.os.linux.misc
From: cgibbs@kltpzyxm.invalid (Charlie Gibbs)
Subject: Re: Joy of this, Joy of that
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<vhqr9n$1b2t7$8@dont-email.me> <rcf0P.211280$pZ%.136218@fx16.iad>
<vhs659$1kb5c$4@dont-email.me>
User-Agent: slrn/1.0.3 (Linux)
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 47
Message-ID: <QRp0P.4717$BuL8.1709@fx03.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sat, 23 Nov 2024 19:16:00 UTC
Date: Sat, 23 Nov 2024 19:16:00 GMT
X-Received-Bytes: 2838
View all headers

On 2024-11-23, Pancho <Pancho.Jones@proton.me> wrote:

> On 11/23/24 07:09, Charlie Gibbs wrote:
>
>> On 2024-11-22, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>
>>> On Fri, 22 Nov 2024 18:53:28 GMT, Charlie Gibbs wrote:
>>>
>>>> All my programs contain a routine called quit_cleanup(); it takes a
>>>> single argument, which is either an error message or NULL.
>>>> It frees all allocated memory, closes any open files, etc.
>>>
>>> But all that is unnecessary if your program is terminating anyway.
>>>
>>> In *nix C code, a common convention is
>>>
>>> if («call failed»)
>>> {
>>> perror(«doing what»);
>>> exit(«nonzero error code»);
>>> } /*if*/
>>>
>>> <https://manpages.debian.org/3/perror.3.en.html>
>>
>> Perhaps, but I'm a belt-and-suspenders guy - I like
>> to explicitly free everything come hell or high water.
>
> I can see that is nice, to understand what you have,
> but it sounds like hard work.

It's not, actually. Think of it like a mechanic methodically
putting all his tools back where they belong in the box when
he's done, rather than leaving them lying around the shop.

> However there are some resource you do need to explicitly
> free/release/close, some database locks for instance.

Therefore, why go the bother of having to memorize which
resources you have to explicity free, and which ones you
don't? Get into the habit of freeing them all - you might
avoid tedious debugging sessions when you forget which is which.

--
/~\ Charlie Gibbs | Growth for the sake of
\ / <cgibbs@kltpzyxm.invalid> | growth is the ideology
X I'm really at ac.dekanfrus | of the cancer cell.
/ \ if you read it the right way. | -- Edward Abbey

Subject: Re: Joy of this, Joy of that
From: Charlie Gibbs
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 19:16 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!news.swapon.de!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx03.iad.POSTED!not-for-mail
Newsgroups: comp.os.linux.misc
From: cgibbs@kltpzyxm.invalid (Charlie Gibbs)
Subject: Re: Joy of this, Joy of that
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad> <vhs153$1k6ft$3@dont-email.me>
<wwvjzcu1chd.fsf@LkoBDZeT.terraraq.uk>
User-Agent: slrn/1.0.3 (Linux)
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 29
Message-ID: <SRp0P.4718$BuL8.3413@fx03.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sat, 23 Nov 2024 19:16:02 UTC
Date: Sat, 23 Nov 2024 19:16:02 GMT
X-Received-Bytes: 2123
View all headers

On 2024-11-23, Richard Kettlewell <invalid@invalid.invalid> wrote:

> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
>> On Sat, 23 Nov 2024 07:09:06 GMT, Charlie Gibbs wrote:
>>
>>> So it's the good old-fashioned way - free
>>> each allocation one by one and hope you don't forget one.
>>
>> One thing that helps is that free(3) is idempotent:
>
> It is not. Freeing the same non-null pointer twice is a bug (and a
> common source of vulnerabilities).
>
>> calling it on a NULL pointer is a harmless no-op, so there is no need
>> to check for NULL before calling it. So my standard technique
>> (simplifying somewhat) is
>
> ‘free() and null out all copies of the pointer that can ever reach
> free() in the future’ is idempotent, if you can get it right (which is
> usually not too hard in a well-organized program).

+1

--
/~\ Charlie Gibbs | Growth for the sake of
\ / <cgibbs@kltpzyxm.invalid> | growth is the ideology
X I'm really at ac.dekanfrus | of the cancer cell.
/ \ if you read it the right way. | -- Edward Abbey

Subject: Re: Joy of this, Joy of that
From: Charlie Gibbs
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 19:16 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx03.iad.POSTED!not-for-mail
Newsgroups: comp.os.linux.misc
From: cgibbs@kltpzyxm.invalid (Charlie Gibbs)
Subject: Re: Joy of this, Joy of that
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<vhqr9n$1b2t7$8@dont-email.me> <rcf0P.211280$pZ%.136218@fx16.iad>
<vhs16a$1k6ft$4@dont-email.me>
User-Agent: slrn/1.0.3 (Linux)
Lines: 37
Message-ID: <URp0P.4720$BuL8.1096@fx03.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sat, 23 Nov 2024 19:16:04 UTC
Date: Sat, 23 Nov 2024 19:16:04 GMT
X-Received-Bytes: 2444
View all headers

On 2024-11-23, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

> On Sat, 23 Nov 2024 07:09:11 GMT, Charlie Gibbs wrote:
>
>> On 2024-11-22, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>
>>> On Fri, 22 Nov 2024 18:53:28 GMT, Charlie Gibbs wrote:
>>>
>>>> All my programs contain a routine called quit_cleanup(); it takes a
>>>> single argument, which is either an error message or NULL.
>>>> It frees all allocated memory, closes any open files, etc.
>>>
>>> But all that is unnecessary if your program is terminating anyway.
>>
>> Perhaps, but I'm a belt-and-suspenders guy - I like to explicitly free
>> everything come hell or high water.
>
> That actually slows down program termination.

The microsecond or two that is wasted is far less than the
debugging time needed when a shortcut goes wrong. And who
knows, you might someday port the program to a different
environment (hardware, OS, or even language) where the
rules are just different enough to cause lots of headaches.

Different strokes for different folks. Some people like to
write the equivalent of a Ferrari, that goes really fast but
is finicky and might lose a wheel if it hits rough terrain.
My code is more like an ATV: a bit slower, not nearly as
pretty, but it'll go anywhere and not break down when things
aren't perfect.

--
/~\ Charlie Gibbs | Growth for the sake of
\ / <cgibbs@kltpzyxm.invalid> | growth is the ideology
X I'm really at ac.dekanfrus | of the cancer cell.
/ \ if you read it the right way. | -- Edward Abbey

Subject: Re: Joy of this, Joy of that
From: Charlie Gibbs
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 19:16 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!news-out.netnews.com!s1-2.netnews.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx03.iad.POSTED!not-for-mail
Newsgroups: comp.os.linux.misc
From: cgibbs@kltpzyxm.invalid (Charlie Gibbs)
Subject: Re: Joy of this, Joy of that
References: <vhigot$1uakf$1@dont-email.me> <6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com> <20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me> <vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net> <vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk> <vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad> <slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid> <mcf0P.211278$pZ%.68099@fx16.iad> <vhs153$1k6ft$3@dont-email.me> <vhs5tj$1kb5c$3@dont-email.me> <vhsef7$1m6qu$6@dont-email.me>
User-Agent: slrn/1.0.3 (Linux)
Lines: 35
Message-ID: <WRp0P.4721$BuL8.634@fx03.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sat, 23 Nov 2024 19:16:06 UTC
Date: Sat, 23 Nov 2024 19:16:06 GMT
X-Received-Bytes: 2226
View all headers

On 2024-11-23, The Natural Philosopher <tnp@invalid.invalid> wrote:

> On 23/11/2024 09:05, Pancho wrote:
>
>> On 11/23/24 07:44, Lawrence D'Oliveiro wrote:
>>
>>> On Sat, 23 Nov 2024 07:09:06 GMT, Charlie Gibbs wrote:
>>>
>>>> So it's the good old-fashioned way - free
>>>> each allocation one by one and hope you don't forget one.
>>>
>>> One thing that helps is that free(3) is idempotent:
>>
>> It isn't idempotent.
>>
>>> calling it on a NULL
>>> pointer is a harmless no-op,
>>
>> OK it is idempotent on NULL, but not in general.
>>
> As I discovered to my shame. freeing the same pointer twice is not
> harmless.

And, IIRC, trying to fclose() a NULL file pointer doesn't work
too well. I like to use a consistent technique that works across
all sorts of resources: memory, file pointers, window handles,
menu handles, etc. But that's just me being too lazy to memorize
a bunch of different cases when a single consistent technique
will work anywhere with neglegible overhead.

--
/~\ Charlie Gibbs | Growth for the sake of
\ / <cgibbs@kltpzyxm.invalid> | growth is the ideology
X I'm really at ac.dekanfrus | of the cancer cell.
/ \ if you read it the right way. | -- Edward Abbey

Subject: Re: Joy of this, Joy of that
From: rbowman
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 19:28 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bowman@montana.com (rbowman)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: 23 Nov 2024 19:28:46 GMT
Lines: 8
Message-ID: <lqeoneFrit1U1@mid.individual.net>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me> <lqcsvtFiao0U1@mid.individual.net>
<vhs544$1kb5c$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net DcyG+m9YcU+Pi6PsRLDrkAL4+L3ZwxuILYjZURDhSnPCV2UnB6
Cancel-Lock: sha1:3KJkrfS0M+3IKasa0681WjKJ+lk= sha256:ASh8dnnKpnWRn7L+BUQfRHiWdCO/vO8OsDvoPAGepgw=
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
View all headers

On Sat, 23 Nov 2024 08:52:20 +0000, Pancho wrote:

> Did it?, there was Objective C too.

I don't know anything about Objective C. That was sort of an Apple thing
and I've never worked on Apple hardware. I'm not trying to start a
religious war but nobody ever wanted to pay me for developing on Apple.

Subject: Re: Joy of this, Joy of that
From: rbowman
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 19:39 UTC
References: 1 2 3 4 5 6 7 8 9
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bowman@montana.com (rbowman)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: 23 Nov 2024 19:39:51 GMT
Lines: 40
Message-ID: <lqepc6Frit1U2@mid.individual.net>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<vhl090$5ghq$1@dont-email.me>
<w4adnUM659THQqP6nZ2dnZfqnPednZ2d@earthlink.com>
<vhndam$ljks$1@dont-email.me> <871pz4osys.fsf@comcast.net.invalid>
<vhp646$12c7u$1@dont-email.me>
<pgidnQQYp91K_dz6nZ2dnZfqnPqdnZ2d@earthlink.com>
<vhsdhp$1m6qu$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net upn+At4lSDf7o5k8AYgCpga7WAwXMGWtLzJIpWm9I4NZrBN32v
Cancel-Lock: sha1:LCI4+fnX4XT05z+m7h9aAmmImZM= sha256:DONSusWk1UlHqg0SvQcYhvzJNfLjqaOhnOqS9W9FM3I=
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
View all headers

On Sat, 23 Nov 2024 11:16:09 +0000, The Natural Philosopher wrote:

> On 23/11/2024 04:57, 186282@ud0s4.net wrote:
>> On 11/22/24 12:51 AM, Lawrence D'Oliveiro wrote:
>>> On Thu, 21 Nov 2024 20:19:55 -0700, Don_from_AZ wrote:
>>>
>>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>>
>>>>> On 21/11/2024 07:20, 186282@ud0s4.net wrote:
>>>>>>
>>>>>> I take it you're also not a fan of Perl  🙂
>>>>>
>>>>> Perfectly Execrable Rubbish Language
>>>>
>>>> I've heard it called:
>>>>
>>>>    "Pathologically Eclectic Rubbish Lister"
>>>
>>> It changed the meaning of the term “high-level language” forever.
>>
>>
>>   Well ... glad to see my opinion of Perl is not unique  :-)
>>
>>   Way back I bought the usual "Learn Perl" book with the camel on the
>>   front. About two chapters in I said "WHY ???".
>>
> I just saw the type of people who created enormous scripts in it, and
> thought 'total wankers' They typically read instruction manuals as a
> hobby...
>
> If a script gets that big it should be in a different language
> altogether.

We had a couple of implementers who used Perl to automate their tasks.
Programming disavowed all knowledge of them. As the years went by and the
original people left they were handed down to successive generations as
some sort of magic tools.

Subject: Re: Joy of this, Joy of that
From: rbowman
Newsgroups: comp.os.linux.misc
Date: Sat, 23 Nov 2024 19:47 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bowman@montana.com (rbowman)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: 23 Nov 2024 19:47:40 GMT
Lines: 23
Message-ID: <lqepqrFrit1U3@mid.individual.net>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad> <vhs153$1k6ft$3@dont-email.me>
<vhs5tj$1kb5c$3@dont-email.me> <vhsef7$1m6qu$6@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 0eE3AyF3F9x8eKmzn6DAvwgLdIf+CtMZUzDAwzpCUhkXl5jDMM
Cancel-Lock: sha1:5Hhq2ONVBwD4OnHbN5NbgXMPkYU= sha256:WTyiZiZ7ye8oB0t578AfwNzDLp3vrfdcIHBdtFlKixY=
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
View all headers

On Sat, 23 Nov 2024 11:31:51 +0000, The Natural Philosopher wrote:

> On 23/11/2024 09:05, Pancho wrote:
>> On 11/23/24 07:44, Lawrence D'Oliveiro wrote:
>>> On Sat, 23 Nov 2024 07:09:06 GMT, Charlie Gibbs wrote:
>>>
>>>> So it's the good old-fashioned way - free each allocation one by one
>>>> and hope you don't forget one.
>>>
>>> One thing that helps is that free(3) is idempotent:
>>
>> It isn't idempotent.
>>
>>> calling it on a NULL pointer is a harmless no-op,
>>
>> OK it is idempotent on NULL, but not in general.
>>
> As I discovered to my shame. freeing the same pointer twice is not
> harmless.

Our legacy software was developed on AIX. As it was moved to Linux we
found that AIX had a much better sense of humor about accessing null
pointers and other indiscretions.

Subject: Re: Joy of this, Joy of that
From: Louis Krupp
Newsgroups: comp.os.linux.misc
Organization: Newshosting.com - Highest quality at a great price! www.newshosting.com
Date: Sat, 23 Nov 2024 20:46 UTC
References: 1 2 3 4 5 6 7 8 9
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!news.quux.org!weretis.net!feeder9.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news-out.netnews.com!s1-3.netnews.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: lkrupp@invalid.pssw.com.invalid (Louis Krupp)
Subject: Re: Joy of this, Joy of that
Newsgroups: comp.os.linux.misc
References: <vhigot$1uakf$1@dont-email.me> <6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com> <vhl090$5ghq$1@dont-email.me> <w4adnUM659THQqP6nZ2dnZfqnPednZ2d@earthlink.com> <vhndam$ljks$1@dont-email.me> <871pz4osys.fsf@comcast.net.invalid> <vhp646$12c7u$1@dont-email.me> <pgidnQQYp91K_dz6nZ2dnZfqnPqdnZ2d@earthlink.com> <vhsdhp$1m6qu$2@dont-email.me>
Content-Language: en-US
In-Reply-To: <vhsdhp$1m6qu$2@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 42
Message-ID: <%ar0P.44258$giU1.34557@fx09.iad>
X-Complaints-To: abuse(at)newshosting.com
NNTP-Posting-Date: Sat, 23 Nov 2024 20:46:51 UTC
Organization: Newshosting.com - Highest quality at a great price! www.newshosting.com
Date: Sat, 23 Nov 2024 13:46:51 -0700
X-Received-Bytes: 2454
View all headers

On 11/23/2024 4:16 AM, The Natural Philosopher wrote:
> On 23/11/2024 04:57, 186282@ud0s4.net wrote:
>> On 11/22/24 12:51 AM, Lawrence D'Oliveiro wrote:
>>> On Thu, 21 Nov 2024 20:19:55 -0700, Don_from_AZ wrote:
>>>
>>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>>
>>>>> On 21/11/2024 07:20, 186282@ud0s4.net wrote:
>>>>>>
>>>>>> I take it you're also not a fan of Perl  🙂
>>>>>
>>>>> Perfectly Execrable Rubbish Language
>>>>
>>>> I've heard it called:
>>>>
>>>>    "Pathologically Eclectic Rubbish Lister"
>>>
>>> It changed the meaning of the term “high-level language” forever.
>>
>>
>>    Well ... glad to see my opinion of Perl is
>>    not unique  :-)
>>
>>    Way back I bought the usual "Learn Perl" book with
>>    the camel on the front. About two chapters in I
>>    said "WHY ???".
>>
> I just saw the type of people who created enormous scripts in it, and
> thought 'total wankers' They typically read instruction manuals as a
> hobby...
>
> If a script gets that big it should be in a different language altogether.
>
There was a time when Python was still at version 1.something, Ruby
hadn't been introduced, so the choices were limited to shells (like sh
and its relatives), compiled languages like C, and Perl. Perl did the
job, and it was enough like C to seem familiar, so here we are.

It could have been worse.

Louis

Subject: Re: Joy of this, Joy of that
From: Pancho
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 20:50 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Pancho.Jones@proton.me (Pancho)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 20:50:27 +0000
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <vhtf6k$1s0t4$1@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<vhqr9n$1b2t7$8@dont-email.me> <rcf0P.211280$pZ%.136218@fx16.iad>
<vhs659$1kb5c$4@dont-email.me> <QRp0P.4717$BuL8.1709@fx03.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 21:50:34 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0996b149b2c257ae77a172fc1c1f1afd";
logging-data="1967012"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0xShXq/4NDVaej1P1EsZSG5aw5ryD6WY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:zJxKq00LL3dvj1/26aYkBu4M9LY=
In-Reply-To: <QRp0P.4717$BuL8.1709@fx03.iad>
Content-Language: en-GB
View all headers

On 11/23/24 19:16, Charlie Gibbs wrote:
> On 2024-11-23, Pancho <Pancho.Jones@proton.me> wrote:
>
>> On 11/23/24 07:09, Charlie Gibbs wrote:
>>
>>> On 2024-11-22, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>>
>>>> On Fri, 22 Nov 2024 18:53:28 GMT, Charlie Gibbs wrote:
>>>>
>>>>> All my programs contain a routine called quit_cleanup(); it takes a
>>>>> single argument, which is either an error message or NULL.
>>>>> It frees all allocated memory, closes any open files, etc.
>>>>
>>>> But all that is unnecessary if your program is terminating anyway.
>>>>
>>>> In *nix C code, a common convention is
>>>>
>>>> if («call failed»)
>>>> {
>>>> perror(«doing what»);
>>>> exit(«nonzero error code»);
>>>> } /*if*/
>>>>
>>>> <https://manpages.debian.org/3/perror.3.en.html>
>>>
>>> Perhaps, but I'm a belt-and-suspenders guy - I like
>>> to explicitly free everything come hell or high water.
>>
>> I can see that is nice, to understand what you have,
>> but it sounds like hard work.
>
> It's not, actually. Think of it like a mechanic methodically
> putting all his tools back where they belong in the box when
> he's done, rather than leaving them lying around the shop.
>

It's more like carefully packing up a set of disposable tools into their
disposable box, and then throwing the whole lot in the bin.

>> However there are some resource you do need to explicitly
>> free/release/close, some database locks for instance.
>
> Therefore, why go the bother of having to memorize which
> resources you have to explicity free, and which ones you
> don't? Get into the habit of freeing them all - you might
> avoid tedious debugging sessions when you forget which is which.
>

It's hard for me to remember, because I'm so used to C# IDisposable
"using" blocks, Java "try-with-resources", even try/catch/finally, etc.
I see even C++ has "Resource Acquisition Is Initialization".

My memory is that in practice you normally want to hold critical
(unmanaged) resources open for as short at time as possible, and hence
you tend to deal with disposal locally to allocation rather than having
long lived stuff that needs to be cleaned on exit. But that is just a
gut felling, I can't really remember enough to talk sensibly on the
subject. I'm sure there are usecases where this doesn't in apply, but in
general I think it does.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 21:36 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 21:36:38 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <vhtht6$1s5d5$5@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me> <vhrbsr$1dqca$2@dont-email.me>
<vhs3ji$1kb5c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 22:36:38 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1971621"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+EqIBfH6hup0MSfQahAeX/"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:6u5jF6KnvRACVbT/KGaYIocY3FU=
View all headers

On Sat, 23 Nov 2024 08:26:26 +0000, Pancho wrote:

> On 11/23/24 01:41, Lawrence D'Oliveiro wrote:
>>
>> “Metaclasses” were just a bit of a hack to implement what Python would
>> call “classmethods”.
>
> I think the Smalltalk idea of treating classes as objects, is the
> opposite of a hack.

That is an elegant idea, but I don’t think it’s what Smalltalk did -- not
with metaclasses, anyway. If you look at the draft (abandoned) ANSI
Smalltalk spec <https://github.com/johnwcowan/smalltalk-standard>, it says
“because classes are not specified as the implementers of behavior,
metaclasses are not needed to provide the behavior of class objects”.

This is in contrast to Python, where metaclasses are very much an integral
part of the behaviour of classes.

> I would say C++ static methods and static variables are a hack.

They are there to provide access to the innards of a private/protected
class, without having to go through instances of that class. In a language
like Python, which doesn’t bother constraining visibility to the innards
of a class, they are just a convenience for grouping purposes, nothing
more.

Much more useful are classmethods, which get passed the class object
itself as an argument. But that’s only possible in a dynamic language, not
like C++, or even Java or C♯.

> C# type reflection is a hack.

Is that like the convoluted “reflection” API in Java? (Mind you, most APIs
in Java seem to be convoluted ...)

> Just as value types are a hack in C#. Things that
> are sensible for performance reasons, but that add complexity.

Presumably, like Java, these mechanisms are there to avoid the need for
the services of the full language compiler at runtime.

> It was easy to see where Python metaclasses came from.

Not really. Which language used metaclasses to instantiate classes before
Python?

Python also does multiple inheritance. And it does it quite nicely,
benefiting from lessons learned in earlier attempts at “linearization”
(coming up with a consistent and minimally-surprising method resolution
order across all the base classes).

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 21:38 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 21:38:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <vhti06$1s5d5$6@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad> <vhsdqr$1m6qu$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 22:38:15 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1971621"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18d+foPgOo3vNaaS2wC+zfo"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:/nqFuJil6EkLEG17u5TAEIHKLfY=
View all headers

On Sat, 23 Nov 2024 11:20:59 +0000, The Natural Philosopher wrote:

> I dislike the use of malloc and friends in daemons that run forever.

It does take some discipline to make sure allocations are managed
properly. Structured programming is your friend.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 21:40 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 21:40:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <vhti42$1s5d5$7@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<vhqr9n$1b2t7$8@dont-email.me> <rcf0P.211280$pZ%.136218@fx16.iad>
<vhs16a$1k6ft$4@dont-email.me> <URp0P.4720$BuL8.1096@fx03.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 22:40:19 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1971621"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/EztW+unlT/AK1p2nL7CHL"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:2/E1OOcOHbdFnTtul4fxiXBojlg=
View all headers

On Sat, 23 Nov 2024 19:16:04 GMT, Charlie Gibbs wrote:

> On 2024-11-23, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>
>> On Sat, 23 Nov 2024 07:09:11 GMT, Charlie Gibbs wrote:
>>
>>> On 2024-11-22, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>>
>>>> On Fri, 22 Nov 2024 18:53:28 GMT, Charlie Gibbs wrote:
>>>>
>>>>> All my programs contain a routine called quit_cleanup(); it takes a
>>>>> single argument, which is either an error message or NULL.
>>>>> It frees all allocated memory, closes any open files, etc.
>>>>
>>>> But all that is unnecessary if your program is terminating anyway.
>>>
>>> Perhaps, but I'm a belt-and-suspenders guy - I like to explicitly free
>>> everything come hell or high water.
>>
>> That actually slows down program termination.
>
> The microsecond or two that is wasted is far less than the debugging
> time needed when a shortcut goes wrong.

Actually, thinking about it, there are some things -- shared memory
sections come to mind -- that are not automatically freed when a process
terminates. But everything else -- memory, open files, network connections
-- will go away automatically.

If you have those persistent things that you want to clean up, your
technique won’t be reliable anyway.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 21:45 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 21:45:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <vhtide$1s5d5$8@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad> <vhs153$1k6ft$3@dont-email.me>
<wwvjzcu1chd.fsf@LkoBDZeT.terraraq.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 22:45:19 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1971621"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19W7lMxSvY6ZzRmUWy6uUNH"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:AKz67eW9Ri3obXktRvPZO8M2W24=
View all headers

On Sat, 23 Nov 2024 10:16:46 +0000, Richard Kettlewell wrote:

> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>>
>> One thing that helps is that free(3) is idempotent:
>
> It is not. Freeing the same non-null pointer twice is a bug (and a
> common source of vulnerabilities).

That’s not what I meant by “idempotent”, and that particular case is easy
to catch anyway, and glibc does so by default. See
<https://manpages.debian.org/3/mallopt.3.en.html>.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 21:48 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 21:48:20 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <vhtij3$1s5d5$9@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me> <lq9h4kF2tegU1@mid.individual.net>
<vhpmo6$14s79$1@dont-email.me> <wwva5drk0m1.fsf@LkoBDZeT.terraraq.uk>
<vhptgf$1614q$1@dont-email.me> <Iq40P.70904$EQue.62359@fx13.iad>
<slrnvk1qft.5gg9.candycanearter07@candydeb.host.invalid>
<mcf0P.211278$pZ%.68099@fx16.iad> <vhs153$1k6ft$3@dont-email.me>
<vhs5tj$1kb5c$3@dont-email.me> <vhsef7$1m6qu$6@dont-email.me>
<WRp0P.4721$BuL8.634@fx03.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 22:48:20 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1971621"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19k72w8mW3fOBJx37+wSPki"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:HtO4wFSsieObCtQyn4GxV7qePxQ=
View all headers

On Sat, 23 Nov 2024 19:16:06 GMT, Charlie Gibbs wrote:

> And, IIRC, trying to fclose() a NULL file pointer doesn't work too well.

Yes, that is an irritation. You need to create your own wrapper that
ignores a “null” file descriptor value (e.g. -1).

But then, you often need to create a wrapper object for managing file I/O
anyway, and it is normally the object disposal routine that closes the
file descriptors in this case. So if it is passed a NULL pointer to
dispose, it doesn’t need to close any file descriptor or do anything else.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 21:57 UTC
References: 1 2 3 4 5 6 7 8 9
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 21:57:09 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <vhtj3l$1s5d5$10@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<vhl090$5ghq$1@dont-email.me>
<w4adnUM659THQqP6nZ2dnZfqnPednZ2d@earthlink.com>
<vhndam$ljks$1@dont-email.me> <871pz4osys.fsf@comcast.net.invalid>
<vhp646$12c7u$1@dont-email.me>
<pgidnQQYp91K_dz6nZ2dnZfqnPqdnZ2d@earthlink.com>
<vhsdhp$1m6qu$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 23 Nov 2024 22:57:09 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2fd1218dfbbc8c3afa5bbf19b4966652";
logging-data="1971621"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/RslIKYlX9l43rSOMyebqn"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:iTGxjAr24dmc5A7kFSQMlIoega8=
View all headers

On Sat, 23 Nov 2024 11:16:09 +0000, The Natural Philosopher wrote:

> I just saw the type of people who created enormous scripts in [Perl],
> and thought 'total wankers' They typically read instruction manuals as a
> hobby...

It’s amazing what you can find out when you RTFM. There was a command just
the other day, in comp.lang.python I think it was, where somebody said
“I’ve been using Python for 20 years, and I never knew that”.

Subject: Re: Joy of this, Joy of that
From: Pancho
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 23:48 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Pancho.Jones@proton.me (Pancho)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sat, 23 Nov 2024 23:48:59 +0000
Organization: A noiseless patient Spider
Lines: 96
Message-ID: <vhtplb$1tioh$1@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me> <vhrbsr$1dqca$2@dont-email.me>
<vhs3ji$1kb5c$1@dont-email.me> <vhtht6$1s5d5$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 24 Nov 2024 00:49:05 +0100 (CET)
Injection-Info: dont-email.me; posting-host="8cce37f5dee4f992fb90ec878c5ed748";
logging-data="2018065"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XnB07yHOIXd8nkMxjAjVGY8/CX0MnaR4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:XtZgVYv+ofnzioluEcDwYcEW7ag=
In-Reply-To: <vhtht6$1s5d5$5@dont-email.me>
Content-Language: en-GB
View all headers

On 11/23/24 21:36, Lawrence D'Oliveiro wrote:
> On Sat, 23 Nov 2024 08:26:26 +0000, Pancho wrote:
>
>> On 11/23/24 01:41, Lawrence D'Oliveiro wrote:
>>>
>>> “Metaclasses” were just a bit of a hack to implement what Python would
>>> call “classmethods”.
>>
>> I think the Smalltalk idea of treating classes as objects, is the
>> opposite of a hack.
>
> That is an elegant idea, but I don’t think it’s what Smalltalk did -- not
> with metaclasses, anyway. If you look at the draft (abandoned) ANSI
> Smalltalk spec <https://github.com/johnwcowan/smalltalk-standard>, it says
> “because classes are not specified as the implementers of behavior,
> metaclasses are not needed to provide the behavior of class objects”.
>

The full quote...

"Class objects have no special significance other than having names and
having behaviors and state distinct from that of
their associated instance objects. Unlike classic Smalltalk definitions
[Goldberg83], they are not defined as being the
containers or implementers of their instances' behavior. The techniques
used to implement the behavior of objects is left to
the implementers. Finally, because classes are not specified as the
implementers of behavior, metaclasses are not needed
to provide the behavior of class objects. "

I learnt Smalltalk nearly 40 years ago, needless to say I learnt from
the Goldberg Smalltalk-80 bluebook, not the current spec.

To be honest, I don't have an idea what classes not being the
implementers of instance behaviour means. Where is instance behaviour
implemented?

> This is in contrast to Python, where metaclasses are very much an integral
> part of the behaviour of classes.
>
>> I would say C++ static methods and static variables are a hack.
>
> They are there to provide access to the innards of a private/protected
> class,

No, C++ static means class method or class variable.

> without having to go through instances of that class. In a language
> like Python, which doesn’t bother constraining visibility to the innards
> of a class, they are just a convenience for grouping purposes, nothing
> more.
>
> Much more useful are classmethods, which get passed the class object
> itself as an argument. But that’s only possible in a dynamic language, not
> like C++, or even Java or C♯.
>
>> C# type reflection is a hack.
>
> Is that like the convoluted “reflection” API in Java? (Mind you, most APIs
> in Java seem to be convoluted ...)
>

Dunno, I very rarely used it. It was more for things like generic
serialisation to JSON.

>> Just as value types are a hack in C#. Things that
>> are sensible for performance reasons, but that add complexity.
>
> Presumably, like Java, these mechanisms are there to avoid the need for
> the services of the full language compiler at runtime.
>

No they are there for performance, because you don't want to have to do
a malloc and instance initialisation for every number you use.

>> It was easy to see where Python metaclasses came from.
>
> Not really. Which language used metaclasses to instantiate classes before
> Python?
>

erm!, erm! I know this one... Smalltalk. Smalltalk-80 if you want to be
picky.

> Python also does multiple inheritance. And it does it quite nicely,
> benefiting from lessons learned in earlier attempts at “linearization”
> (coming up with a consistent and minimally-surprising method resolution
> order across all the base classes).

Yeah, we discussed this in the past. I'm totally unconvinced of the
desirability of complex multiple inheritance linearization.

I'm actually quite unconvinced by Python.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sun, 24 Nov 2024 00:31 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sun, 24 Nov 2024 00:31:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <vhts55$1tu8n$1@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me> <vhrbsr$1dqca$2@dont-email.me>
<vhs3ji$1kb5c$1@dont-email.me> <vhtht6$1s5d5$5@dont-email.me>
<vhtplb$1tioh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 24 Nov 2024 01:31:34 +0100 (CET)
Injection-Info: dont-email.me; posting-host="27ab7e63bed7df08cdacd32e400e7f6c";
logging-data="2029847"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/mmVtek0naF5cIwcm7BfA3"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:M4XDlMLbOSXx6azmsOZI02vPS/s=
View all headers

On Sat, 23 Nov 2024 23:48:59 +0000, Pancho wrote:

> To be honest, I don't have an idea what classes not being the
> implementers of instance behaviour means. Where is instance behaviour
> implemented?

From further up: “A behavior is the set of methods used by an object to
respond to messages”. Since a class itself has no such “behavior”, it
doesn’t need to be an instance of anything, unlike Python.

>>> I would say C++ static methods and static variables are a hack.
>>
>> They are there to provide access to the innards of a private/protected
>> class,
>
> No, C++ static means class method or class variable.

There are no “class methods” or “class variables” as such in C++: in C
terms, they have “static linkage”. The “class” part is just a visibility
restriction.

>>> Just as value types are a hack in C#. Things that are sensible for
>>> performance reasons, but that add complexity.
>>
>> Presumably, like Java, these mechanisms are there to avoid the need for
>> the services of the full language compiler at runtime.
>>
> No they are there for performance, because you don't want to have to do
> a malloc and instance initialisation for every number you use.

Ah, like the distinction between “primitive types” and “reference types”
in Java.

Python manages to avoid this arbitrary separation: “int”, “float”, “str”,
“dict” etc are builtin types, and they are classes almost exactly like
classes you define yourself; and in particular you can subclass them.

>> Python also does multiple inheritance. And it does it quite nicely,
>> benefiting from lessons learned in earlier attempts at “linearization”
>> (coming up with a consistent and minimally-surprising method resolution
>> order across all the base classes).
>
> Yeah, we discussed this in the past. I'm totally unconvinced of the
> desirability of complex multiple inheritance linearization.

It is useful, for example, for creating enumerations of fixed instances of
some particular base class. You inherit from both your particular base
class as well as the generic “enum.Enum” base class, to get suitable
properties of both.

> I'm actually quite unconvinced by Python.

Python manages to provide a small, powerful language core that includes
features that, for example, Java and C♯ had to leave out: lexical binding,
functions and classes as first-class objects, operator overloads,
arbitrary-precision integers, list comprehensions, dictionary and set
expressions, descriptors, metaclasses ... this then allows for library
modules to build on this core to provide powerful facilities in the form
of “domain-specific (sub)languages” (DSLs) that are specialized to
particular problem areas.

For example, you don’t need “generics” or “templates”, à la Java/C++ etc,
because you can define a “class factory” function that constructs new
classes at runtime.

Subject: Re: Joy of this, Joy of that
From: 186282@ud0s4.net
Newsgroups: comp.os.linux.misc
Organization: wokiesux
Date: Sun, 24 Nov 2024 01:17 UTC
References: 1 2 3 4 5 6 7 8 9
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!border-1.nntp.ord.giganews.com!nntp.giganews.com!local-2.nntp.ord.giganews.com!Xl.tags.giganews.com!local-4.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 24 Nov 2024 01:17:41 +0000
Subject: Re: Joy of this, Joy of that
Newsgroups: comp.os.linux.misc
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<vhl090$5ghq$1@dont-email.me>
<w4adnUM659THQqP6nZ2dnZfqnPednZ2d@earthlink.com>
<vhndam$ljks$1@dont-email.me> <871pz4osys.fsf@comcast.net.invalid>
<vhp646$12c7u$1@dont-email.me>
<pgidnQQYp91K_dz6nZ2dnZfqnPqdnZ2d@earthlink.com>
<vhsdhp$1m6qu$2@dont-email.me>
From: 186283@ud0s4.net (186282@ud0s4.net)
Organization: wokiesux
Date: Sat, 23 Nov 2024 20:17:16 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <vhsdhp$1m6qu$2@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <X4KcnQQzFNko49_6nZ2dnZfqnPWdnZ2d@earthlink.com>
Lines: 68
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 99.101.150.97
X-Trace: sv3-FbISJvpDamdV6CSGJNq407W0zbHajvHJmM0fWWqvBFyc0lKZCG9KhwtD7tR1te8hi/TKVmQOZzInGIG!XajdlRiIvcDJ7NasyoHCkwx20FBGBNNTJUhPZ2MlMgm5kGrTUXUf9QiSQQx6/ktipn+r5K+8wqu3!2jnDSX8jCdxnUPLypL3D
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

On 11/23/24 6:16 AM, The Natural Philosopher wrote:
> On 23/11/2024 04:57, 186282@ud0s4.net wrote:
>> On 11/22/24 12:51 AM, Lawrence D'Oliveiro wrote:
>>> On Thu, 21 Nov 2024 20:19:55 -0700, Don_from_AZ wrote:
>>>
>>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>>
>>>>> On 21/11/2024 07:20, 186282@ud0s4.net wrote:
>>>>>>
>>>>>> I take it you're also not a fan of Perl  🙂
>>>>>
>>>>> Perfectly Execrable Rubbish Language
>>>>
>>>> I've heard it called:
>>>>
>>>>    "Pathologically Eclectic Rubbish Lister"
>>>
>>> It changed the meaning of the term “high-level language” forever.
>>
>>
>>    Well ... glad to see my opinion of Perl is
>>    not unique  :-)
>>
>>    Way back I bought the usual "Learn Perl" book with
>>    the camel on the front. About two chapters in I
>>    said "WHY ???".
>>
> I just saw the type of people who created enormous scripts in it, and
> thought 'total wankers' They typically read instruction manuals as a
> hobby...
>
> If a script gets that big it should be in a different language altogether.

Well .... MAYbe they caught "The Joy Of Perl" - though
it's hard to imagine such a thing ......

I've seen huge scripts in Bash as well. There was someone
in these groups who always said they didn't need 'C' or
Python or whatever because, no matter, they could and
wanted to do it with Bash and any other approach proved
you were stupid and incompetent.

But yea ... there soon comes a point where you ought
to implement in a better, more proper, language.
Whatever it is, at least use Python if for no other
reason than that it's generally comprehensible. They
kept expanding Bash with more obscure squiggles and
bars and "two spaces, not one" almost to the point
where you may as well be using BrainFuck or similar.

The biggest Bash script I ever did was about 300 lines,
for backing up all the drives shared on the system. The
saving point was that what I was doing was very 'modular',
maybe 25 lines for each share, almost perfectly repeated
on down the tree. Confirm share exists, try to create
a tempshare, confirm that exists, read file, encrypt
file, fix-up the tree, transfer file ..." that
sort of thing. Copy, tweak and insert module if some new
share had been made.

But I soon re-did it in Python. MUCH better.

> It reminds me of a cartoon picture of a nerd saying 'I use a Unix based
> operating system. My computers crash about as often as I get laid'

It's tough life being a nerd.

Subject: Re: Joy of this, Joy of that
From: 186282@ud0s4.net
Newsgroups: comp.os.linux.misc
Organization: wokiesux
Date: Sun, 24 Nov 2024 01:23 UTC
References: 1 2 3 4 5 6 7 8 9
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!border-4.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 24 Nov 2024 01:23:48 +0000
Subject: Re: Joy of this, Joy of that
Newsgroups: comp.os.linux.misc
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<vhl090$5ghq$1@dont-email.me>
<w4adnUM659THQqP6nZ2dnZfqnPednZ2d@earthlink.com>
<vhndam$ljks$1@dont-email.me> <871pz4osys.fsf@comcast.net.invalid>
<vhp646$12c7u$1@dont-email.me>
<pgidnQQYp91K_dz6nZ2dnZfqnPqdnZ2d@earthlink.com>
<vhrpc7$1jata$2@dont-email.me>
From: 186283@ud0s4.net (186282@ud0s4.net)
Organization: wokiesux
Date: Sat, 23 Nov 2024 20:23:47 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <vhrpc7$1jata$2@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <sMacnXsCArW5Hd_6nZ2dnZfqnPqdnZ2d@earthlink.com>
Lines: 21
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 99.101.150.97
X-Trace: sv3-uP2qbyEd6O51AGOB8WQ5+kAsD74QsQxacgdioCw/5eUIa30oQuRRWqqHtqmixwt0RXJEmFNehpz2mtW!fCx1gGoe7b9LFOLIhYf96ZxwOppcJkwA0W77afif6oX0if9XujSwmZpg1LF8elNMrh8h/uoRMdgt!DKtOopbZW9VCk6ZBlSYp
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

On 11/23/24 12:31 AM, Lawrence D'Oliveiro wrote:
> On Fri, 22 Nov 2024 23:57:58 -0500, 186282@ud0s4.net wrote:
>
>> Way back I bought the usual "Learn Perl" book with the camel on the
>> front. About two chapters in I said "WHY ???".
>
> Perl was designed by a bunch of clever people, who understood the sort of
> features they wanted to add. The trouble is, they did it in kind of an ad-
> hoc way, so the syntax, like Topsy, “just growed”.

"Feature creep" ... you keep having to figure out how
to jam new stuff into the middle of the old stuff until
you just have a total MESS. That's when you're supposed
to totally re-do, or abandon, but Perl was already too
well 'established' so they were stuck with what/how '
came before.

As the Frog Guy said - "It's a TRAP !"

"Organic evolution" is fine - but sometimes you wind up
with a platypus.

Subject: Re: Joy of this, Joy of that
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.misc
Organization: A noiseless patient Spider
Date: Sun, 24 Nov 2024 02:06 UTC
References: 1 2 3 4 5 6 7 8 9 10
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: Sun, 24 Nov 2024 02:06:04 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <vhu1mb$1uqb7$2@dont-email.me>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<vhl090$5ghq$1@dont-email.me>
<w4adnUM659THQqP6nZ2dnZfqnPednZ2d@earthlink.com>
<vhndam$ljks$1@dont-email.me> <871pz4osys.fsf@comcast.net.invalid>
<vhp646$12c7u$1@dont-email.me>
<pgidnQQYp91K_dz6nZ2dnZfqnPqdnZ2d@earthlink.com>
<vhrpc7$1jata$2@dont-email.me>
<sMacnXsCArW5Hd_6nZ2dnZfqnPqdnZ2d@earthlink.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 24 Nov 2024 03:06:04 +0100 (CET)
Injection-Info: dont-email.me; posting-host="27ab7e63bed7df08cdacd32e400e7f6c";
logging-data="2058599"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UgrVZ6prQhr7qhUyie7Qe"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:RECpvcgso9SeIBzjrPzLZKOosIk=
View all headers

On Sat, 23 Nov 2024 20:23:47 -0500, 186282@ud0s4.net wrote:

> "Feature creep" ... you keep having to figure out how to jam new
> stuff into the middle of the old stuff until you just have a total
> MESS. That's when you're supposed to totally re-do, or abandon, but
> Perl was already too well 'established' so they were stuck with
> what/how ' came before.

Which is where the Perl 6 project came in. But it took so long to come to
fruition, and was such a radical change, that it was decided to stop
calling it “Perl” altogether, and make it an entirely new language --
“Raku”, I think is the name now.

Subject: Re: Joy of this, Joy of that
From: rbowman
Newsgroups: comp.os.linux.misc
Date: Sun, 24 Nov 2024 05:01 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bowman@montana.com (rbowman)
Newsgroups: comp.os.linux.misc
Subject: Re: Joy of this, Joy of that
Date: 24 Nov 2024 05:01:30 GMT
Lines: 30
Message-ID: <lqfq99F2ek8U1@mid.individual.net>
References: <vhigot$1uakf$1@dont-email.me>
<6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com>
<20241120081039.00006d2a@gmail.com> <vhlium$93kn$1@dont-email.me>
<vhmprp$iaf1$1@dont-email.me>
<LASdnSkA69I3yKL6nZ2dnZfqnPWdnZ2d@earthlink.com>
<vhoeap$r8gq$2@dont-email.me> <vhpmq3$14s79$2@dont-email.me>
<vhq1f7$16bou$1@dont-email.me> <vhqm4g$1aarf$1@dont-email.me>
<vhr2r7$1cdln$1@dont-email.me> <vhr8hh$1ddh7$2@dont-email.me>
<vhr9u1$1dh3s$1@dont-email.me> <vhrbsr$1dqca$2@dont-email.me>
<vhs3ji$1kb5c$1@dont-email.me> <vhtht6$1s5d5$5@dont-email.me>
<vhtplb$1tioh$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 2CaR05EsgDGz5Rg2BLSxfwEf+1TjOyrWVxGHNdPZVGFaZtAwQS
Cancel-Lock: sha1:eKIyn37tuCsNgF0JZ0gIY9/1KdA= sha256:Llu7aPYJg2Vu0HAWLRZzF6dHPaiF15W7Ca8sAduwu34=
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
View all headers

On Sat, 23 Nov 2024 23:48:59 +0000, Pancho wrote:

> I'm actually quite unconvinced by Python.

For many things it provides a convenient level of abstraction if
performance isn't a major concern. It's not so much the language itself as
that the language has become very popular and the range of modules has
greatly expanded.

For example, the Esri Python API makes common GIS manipulations less
painful than using C++. Similarly if you're into machine learning while
TensorFlow and PyTorch have C++ bindings almost all tutorials will use
Python. In data science Python is starting to overtake R and is actually
faster for some operations. For REST APIs you have flask, django, and
several other frameworks.

For embedded work as Arm microprocessors have become the norm and SRAM has
greatly increased a Python interpreter, either MicroPython or
CircuitPython can be loaded on the device. Again you can work in C++ and
get greater speed and control but it comes at a cost. Controlling a servo
with PWM is easy in Python. Doing it in C++ means you need to determine
the slice and channel for the GPIO pin, decide what to load into the
counter to get the desired frequency from the 125 MHz clock,determine if
you need to use the divider for lower frequencies, and make other
decisions.

Using Python means you get uniformity across many disciplines and it's
good enough for most things. It could have been Perl if it hadn't gotten
stuck in the tar pits, or Ruby, or Go but from whatever twist of fate
occurred it was Python.

Pages:12345678910111213141516171819202122232425262728293031323334

rocksolid light 0.9.8
clearnet tor