Well, it seems I was way to quick to discard the potential in the let() statement.
I find myself using it all the time now :-)
Here’s an example of a refactured formula, where I’ve used let() in the refactored version.
I can now discard most of the comments, as the variable names now holds the clue to what they contain/represent.
The script is for (one of several) sources powering saturation attributes.
Without let():
/* Fades saturation from 100 to 0 and back to 100 during hue shift from color to white. Makes shift from RTA hue to mix-on color for RGB white without visually cycling through the intervening color space. --- recall(1) = Flag for vox activity per fixture (0|100). Replace +X with fixture index. recall(2) = Hue from RTA (incl. offset). recall(72) = Slider id for Break-White brightness. recall(73) = Slider id for Vox-White brightness. recall(76) = Slider id for fade-in duration of Vox-White. recall(77) = Slider id for fade-out duration of Vox-White. grecall(0) = Flag for break/song state (0|100). grecall(20) = Modified fade-in duration of break-white (song to break). grecall(21) = Modified fade-out duration of break-white (break to song). */ crossfade( /* Fade-in = Song state / Fade-out = Break state. */ fadein.linear(grecall(21), fadeout.linear(grecall(20), if (slider(recall(72)) == 0, 100, grecall(0)))), /* Song state */ if (slider(recall(73)) == 0, 100, min ( abs( /* Fade-in = Vox White / Fade-out = Song color. Replace +X with fixture index. */ fadein.linear(slider(recall(76)), fadeout.linear(slider(recall(77)), recall(1) + 0)) * 2 - 100 ), abs( /* Fade-in = Song state / Fade-out = Break state */ fadein.linear(grecall(21), fadeout.linear(grecall(20), grecall(0))) * 2 - 100 ) ) ), /* Break State */ abs( /* Fade-in = Song state / Fade-out = Break state */ fadein.linear(grecall(21), fadeout.linear(grecall(20), grecall(0))) * 2 - 100 ) )And here with the let() statement.
It greatly reduces clutter an improves legibility: