Menu ▾ ▴

#5877 translate_file gives a wrong value to a top-level chained assignment like x1 : x2 : 5

None
open
nobody
5
3 days ago
3 days ago
No

By Claude:

In a file translated with translate_file, a top-level chained assignment gives the outer variable the name of the inner variable instead of the value. With a file n.mac containing x1 : x2 : 5$:

(%i1) load(second(translate_file("n.mac")))$
(%i2) [x1, x2];
(%o2)                               [x2, 5]

Interpreted, x1 : x2 : 5$ gives [5, 5]. The same happens for any top-level assignment whose value contains an assignment, e.g. a1[1] : v1 : 9, define_variable(u1, u2 : 4, any) or f1 : lambda([], w1 : 3) (then f1() returns w1 instead of 3). When the outer variable checks its value, loading the translated file fails instead. With m.mac containing fpprec : p : 25$:

(%i3) load(second(translate_file("m.mac")))$
fpprec: value must be a positive integer; found: p

share/vector/vect.mac has such a line at top level, dotassoc: dotexptsimp: false$, so translated, it sets dotassoc to the symbol dotexptsimp.

Discussion


Log in to post a comment.