Hacker News new | ask | show | jobs
by Gordonjcp 1126 days ago
> I regularly use a ‘let’ and wish I could just have the entire conditional feed into a ‘const’ given it’s never going to change after the block of code responsible for assignment.

I'm currently doing a lot of audio work, where I kind of want to define some parameters early on that won't change, except if something "magic" happens. So, a kind of "unlockable" constant. Think in terms of, a bunch of filter coefficients that are predetermined by the design of the filter but need to be calculated to match a given sample rate.

Just a kind of "set and forget" variable, that ought not be written to more than once, or maybe only written to by the thing that first wrote it.