gen~.dynamicexpr Character Limit

zuei's icon

I am experimenting with the technique described in the "gen~.dynamicexpr" patch in the gen examples folder (on-the-fly replacement of gen~ codebox code through patcher scripting). Unfortunately, I'm running into what seems to be a upper limit on the number of characters in the code string (from my testing, the limit seems to be at 4030 characters, including newline chars). I also tried to remove all whitespace characters from the code string, which did not help. Is there any way to circumvent this limit?

Here's a minimal working example patch to demonstrate (requires the js file to be in the same folder):

Max Patch
Copy patch and select New From Clipboard in Max.
gen_dynamicexpr_char_limit.js
js