←back to thread

498 points azhenley | 1 comments | | HN request time: 0s | source
Show context
storus ◴[] No.45772068[source]
I had enormous fun optimizng C++ via self-modifying assembly to squeeze the utmost performance of some critical algorithms, and now this drive towards immutable everything feels like cutting my hands and legs off and forcing me to do subpar engineering.
replies(2): >>45772538 #>>45772766 #
ryandrake ◴[] No.45772538[source]
Same here, I grew up in a world where you had a handful of registers and a bunch of memory locations, and those were your variables.

                clc
                lda value
                adc #1
                sta value
                lda value+1
                adc #0
                sta value+1

    value       .byte 0,0
These constraints are pretty much built into my concept of programming and it would take great effort to break out of it. It feels nice doing:

    x = 20
    x = x + func(y)
    x = x / func(z)
And it would feel weirdly wasteful to do:

    x = 20
    x1 = x + func(y)
    x2 = x1 / func(z)
Like, I know that variables are no longer a scarce resource, but my brain still wants to conserve them.
replies(1): >>45772849 #
1718627440 ◴[] No.45772849[source]
To me this also seem to be wasteful, even if not for the computer, but it wastes my amount of working state I can keep in my head, which is very limited.
replies(1): >>45776955 #
1. restalis ◴[] No.45776955{3}[source]
I was thinking about this too. When you read a program, there is this information payload, which is the metaphorical ball you have to keep your eyes on, and more or less forget about the rest as soon as it isn't relevant any more. In the functional paradigm it's like seeing the juggle of a bunch of such balls instead (plus the expectation to admire it), but that's just wasteful on reader's attention.