Bizarre "Let" behavior in outdated custom function call
Operating system version
OS X 10.7.5
Description of the issue
If a calculation field (let's say unstored so we can see the results updating when we click in the field) uses a custom function which has a certain number of parameters, and if said custom function uses the Let function, things get weird if you then add or remove parameters from the custom function without remembering to update the calculation field's parameter call.
Steps to reproduce the problem
In a new file, make custom function Fun1 with parameters V1, V2, and V3. The function's calculation might be something like this (it's not important whether we actually use said parameters in the calculation):
Let ( [ a = "Hello"; b = "world" ]; a & " " & b )
Then duplicate that function as Fun2. Now create two unstored calculation fields, Result1 and Result2. Make Result1 call Fun1 ( 1; 2; 3 ), and make Result2 call Fun2 ( 1; 2; 3). Their results are both "Hello world" as you'd expect.
Now alter the parameter count for both functions: in Fun1, remove V3. In Fun2, add a fourth parameter, V4. Save both and click into the calculation fields' contents to see them reevaluate oddly. I show "3 Hello" for Result1 and "world ?" for Result2.
If a calculation field references a custom function using an outdated number of parameters, it should fail gracefully. Perhaps a question mark or a blank result would suffice. Or even better, Fun1 should ignore the third parameter if it only needs two, and Fun2 should regard V4 as empty if only passed three parameters.
The Let function's use of memory appears compromised in some way due to the faulty number of parameters supplied by the calculation.
Be really careful not to change parameter counts in custom functions without updating calculations which reference them.