🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++
Article #102

Re: “The end of software secrecy is almost upon

#102
From: Lawrence D’Oliveiro
Date: Tue, 20 Oct 2026 20:20
33 lines
2756 bytes
On Tue, 20 Oct 2026 15:06:48 -0500, Lynn McGuire wrote:

> The key to writing any software is lots of commenting.

A key point about comments is they should explain *why* the code is
doing what it’s doing, not simply repeat *what* it is doing. E.g.

    watcher = inotify.Watcher.create()
    watching = {}
    # Monitor immediate containing directories for possibility of files
    # disappearing, assuming those directories will not themselves disappear!
    FILE_EVENTS = \
        { # watch for the file itself changing or disappearing
            IN_BIT.CLOSE_WRITE,
            IN_BIT.DELETE_SELF,
            IN_BIT.MOVE_SELF,
            IN_BIT.MASK_CREATE, # files mustn’t be the same!
        }
    for key in path_keys :
        path = config[key]
        parent = os.path.dirname(path) # assumes I don’t need to normalize path
        watching[path] = watcher.watch(path, FILE_EVENTS)
        # plus a watch on parent directory for disappeared file coming back:
        # (This won’t work if file was symlinked; do I care?)
        if parent not in watching :
            # files will typically be in same directory
            watching[parent] = watcher.watch \
              (
                parent,
                {IN_BIT.CREATE, IN_BIT.MOVED_TO, IN_BIT.ONLYDIR}
              )
        #end if
    #end for
Technical Details
Message-ID: <11b8ien$3b48o$4@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11amvre$15far$1@dont-email.me> <11b6v90$2nine$3@dont-email.me> <11b87t8$379mv$1@dont-email.me> <11b8b2k$p44i$1@dont-email.me> <11b8bga$6hk$1@panix2.panix.com> <11b8hkq$3bdtq$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D’Oliveiro <ldo@nz.invalid>
Newsgroups: comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers
Subject: Re: “The end of software secrecy is almost upon
Date: Tue, 20 Oct 2026 20:20:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <11b8ien$3b48o$4@dont-email.me>
References: <11amvre$15far$1@dont-email.me> <11b6v90$2nine$3@dont-email.me>
	<11b87t8$379mv$1@dont-email.me> <11b8b2k$p44i$1@dont-email.me>
	<11b8bga$6hk$1@panix2.panix.com> <11b8hkq$3bdtq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 20 Oct 2026 20:20:40 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3510552"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19aQ3Yb/zLoaEWs5NjI11q8"; posting-host="bb545ab4c326d2444d7ace2ad38ea6bc"
User-Agent: Pan/0.165 (Kostiantynivka)
Cancel-Lock: sha1:1UO015aghr94p3Hrxd1Rz49vtt4= sha256:5JEmgLosmzyH4okGGnAWYcGF9QYiLrA3ZopFYFlm0Sc=
	sha1:Z8KuxNwKfg7opBNj6jaG0+4aOQg= sha256:9dDpFBeQauFJoVr95RKkb8l9IqsukssmLLEuKsL13Qw=