🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: “The end of software secrecy is almost upon

#1196
From: Lawrence D’Oliveiro
Date: Sun, 06 Dec 2026 01:17
50 lines
3448 bytes
On Sun, 6 Dec 2026 00:28:00 +0000, Tristan Wibberley wrote:

> "why" doesn't really belong in the code.

Put it anywhere else, and it becomes separated from the code.

Comments shouldn’t repeat what the code does, they need to explain
*why* the code is doing what it’s doing.

Example:

    key += 0.01 # sort literal numbers before expressions evaluating to those numbers

Cryptic, because out of context. With some more context:

    def construct(self, a, b) :
        "constructs an expression using the operator and the specified operands."

        def flatten(subexpr) :
            "if subexpr has the same operator as myself and I am groupable, returns a list of" \
            " its (recursively) extracted operands, so I can group them into single operator" \
            " instance."
            ... definition omitted ...
        #end flatten

        def canonical(expr) :
            "defines a canonical ordering for operands of a groupable operator."
            if isinstance(expr, Expr) or isinstance(expr, Num) :
                key, valid = expr.eval()
                if not valid :
                    key = 0
                #end if
                if isinstance(expr, Expr) :
                    key += 0.01 # sort literal numbers before expressions evaluating to those numbers
                #end if
            else :
                raise RuntimeError("unexpected expr type %s" % repr(type(expr)))
            #end if
            return key
        #end canonical

    #begin construct
        opnds = flatten(a) + flatten(b)
        if self.groupable :
            opnds = sorted(opnds, key = canonical)
        #end if
        return Expr(self, opnds)
    #end construct

Bit clearer now, why it’s doing what it’s doing?
Technical Details
Message-ID: <11f2d30$3h58e$2@dont-email.me>
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!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> <11b8ien$3b48o$4@dont-email.me> <aengell8ipmbe2n363ajesde6j1086e0ve@4ax.com> <11c9nkt$1d76i$2@dont-email.me> <11f2a6g$3ca6h$4@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!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: Sun, 6 Dec 2026 01:17:21 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <11f2d30$3h58e$2@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>
	<11b8ien$3b48o$4@dont-email.me> <aengell8ipmbe2n363ajesde6j1086e0ve@4ax.com>
	<11c9nkt$1d76i$2@dont-email.me> <11f2a6g$3ca6h$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 06 Dec 2026 01:17:21 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3708174"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/FQHdl08Zs+ObzIOndgCZJ"; posting-host="5b5417326a42ec0cca9cb4da8702e768"
User-Agent: Pan/0.165 (Kostiantynivka)
Cancel-Lock: sha1:Cp9fmPIaqVwgkZXahQ/PF5pHOqI= sha256:x+CdQFOYF9+FZ4cqwg0U/gc+qDL1prD+788B8/sH9D0=
	sha1:wbfUOm2sORvuD4Q8UO/gKVj84Jo= sha256:ybHuz7mq8eMidfXOPJ2XwHovL6YFHlgV+GdctNpY0Io=