Menu ▾ ▴

#5879 Translated code ignores the setter of inchar, outchar and linechar

None
open
nobody
translator (11)
5
3 days ago
3 days ago
No

By Claude:

Assigning a string to inchar, outchar or linechar turns it into a symbol, and assigning anything other than a string or symbol is an error. Translated and compiled code skips both. It stores the string itself, after which every prompt fails and Maxima loops forever:

(%i1) f() := (inchar : "j", 0)$
(%i2) translate(f)$
(%i3) f()$
Maxima encountered a Lisp error:

 The value
   "j3"
 is not of type
   SYMBOL
...

The interpreted f() sets inchar to the symbol j instead. Translated inchar : 5 is also accepted without an error, while the interpreter says assignment: cannot assign5' to inchar': Must be a string or symbol. The same happens for binding, as in block([inchar : "j"], ...) or a function with a parameter named inchar.

Discussion


Log in to post a comment.