radian628 / desmoscript

Desmos scripting language and successor to LISPsmos.
101 stars 8 forks source link

fix nested macro instantiation issue #9

Open radian628 opened 1 year ago

radian628 commented 1 year ago

Let's say we have compilation units A and B. A instantiates a macro from B which contains multiple layers of nested macros. Logically, the nested macros within B should refer to other macros in relation to B's scopes. However, the bug is that they'll just be naively pasted into A and then searched for in A's scopes.

As an example, B is a matrix library and A is a graph using it. The 3x3 matrix identity macro in B, which itself calls the regular 3x3 matrix macro, would first instantiate the regular 3x3 matrix macro within A. It would then look for the regular 3x3 matrix macro within A instead of doing in my opinion the more logical thing and look for it within B.