[OT] Move semantics in a nutshell
monkyyy
crazymonkyyy at gmail.com
Mon Nov 10 00:49:22 UTC 2025
On Sunday, 9 November 2025 at 23:41:28 UTC, Timon Gehr wrote:
> Invariants are also not saying "the program crashes sometimes",
> they are saying "the program only uses these specific
> combinations of bit patterns".
You claimed my ubyte example was "an invariant", using all 2^8 of
ubytes space isn't a *specific* combination. Your using math
language and logic here, you can say "the empty set is a set" but
nah that aint real english 0 be a special case, if I handle all
possible bit patterns my "invariants" drop to be
`assert(1==1,"math stopped working")`type things; if your disk
runs out of memory, or cosmic rays corrupt the os, or or or or or
or; these airnt my problems anymore. I write `opIndex(int)` I
think "hmmm what are the possible `int`s" and then I handle those
cases, I dont "solve" problems with rants in docs, or add
function coloring or ask for a big math proofer.
Insiting the way I write code fits your mental model while I
continuous insit I'm not, is insane. Uncle bob may walk into a
code base and go "hmmm, yes this is a visitor pattern", but if
the author generally says "uncle bob is a con artist and should
be shoot", It may "fit" but it doesn't "use" uncle bobs ideas.
I consider everything I do to just be dumb strong types. If its a
panacea, its been there since the beginning and it aint that hard
to call the so called experts with their "important exceptions"
stupid. `1/0==int.max` god damn hardware bugs making me write
work'onds.
> invariants are a thing, programming languages have to contend
> with them
The compiler is unable to act on "slices cant point at invalid
memory" so it doesnt and the os's whines; it can and does have
opinions on int sizes and its 1 to 1 with reality.
Types are more fundamental ground truth for what compilers work
with, ints are far more real as something in a header then a rant
in the spec.
> it could also just start overwriting your hard disk with random
> garbage
I aint never seen an undefined behavior do this even once
`int.max+1` maybe its an int.max maybe its int.min, maybe its 0,
maybe is some pathological platform its a random int, but I aint
never seen no delete harddrive unless you let code from 4chan
run, and let me tell ya it wasnt by mistake.
More information about the Digitalmars-d
mailing list