Subject: bug#46750: calc defmath let* behaviour surprising, inconsistent, or wrong

From: Mattias Engdegård <[email-masked]>
Date: Mon, 1 Mar 2021 21:12:44 +0100

> Thank you Stephan, it does indeed look like a bug.

Not one but quite a few. Apart from the incorrect variable scoping in let* that you noticed, the `defmath`-specific forms `for` and `foreach` had the same problem: even the examples in the manual didn't work.

Moreover, `foreach` didn't work at all as specified -- it is supposed to iterate over list elements but only ran over the list tails. As I was writing tests, it turned out that the facility to quote functions as a means to override the substitution of `calcFunc-`-prefixed names didn't work at all.

These have now been fixed on master (08b11a02f49da5ca0e4e58a32fa853df0c5e0214); please tell me if it helped. Given the number of flaws discovered in this part of the code, I wouldn't be surprised if there are more to be found.