js-slang
js-slang copied to clipboard
NATIVE: depth of display of values in REPL error messages
Chrome in MacOS:
https://sourceacademy.nus.edu.sg/playground#chap=2&ext=RUNES&prgrm=PTAEENQBwSwDwKYBsD6BnAxgCwQWwaDGhKAGYCuAdhgC4wD2lZATvbiVPWjHY6DfVDMqCAFAhoXHgyZFQAcxgA3BEwDuPLKCXgk5BMRigAFKzUBKIeEqKb4sKVbsADP0FMAtKACMAGgiUACagAFYmGPR6uJSWzNa28ixs9qCuAqDsXt6iohTUvEwARkjgGADWKLCIqJg4%2BMYw-iH%2BlP64lgDeoqA9Qgg05MxFJeXGaACO5ODMCOYA3KIAvjl5tDKgEUj0zBSoVcjo2HgIDU0tbZ3dvVc9MwNDG5HbY5PTCE09YK2Enxn%2BzgA6ACs8yWKyoaz4m22uxQGBgzAw5BKzEq8AOtWOp1C5wyl16j0oaBooECcFAAF4MuAaFgUOBCmgGqAvEwwAAmUEEiJEkmBACelOptPpjOMYS87A5XN6POJpKFuBpdImzBoxjJACoyaAANSk-na-ky279QZMaHMF5TGb%2BYJff7%2Bbyg5a5CEFaAwWiDE7fXD%2BfY1I74fG9VYepVlBAoMzYkKhgmm%2B5MMIUtOpUAAflAExtYkTBdAAC5QIUDDBAtHHKVjOKWT5LGBmjdC63W5Ho7HGqF687fC224PeoHDnUTt3mqA-eYTaBlgTw%2BsO%2BhXjMGgnE3dzT801TXNnc28B4WS8TShVqxha0Yso3CP5j0P2%2BAoyu88zb-2n9-l12Lo-v0TWd516LcHmXQ81xiBZXTQLB6DUYxYG9NcgWcZx-DQjDHi2HZkTRapR2OGcFiAA
gives this in JavaScript console and browser hangs:

This program now produces a nice error message in the REPL:
Line 31: Potential infinite recursion detected: stack_frac(0.9953271028037384, { "isPrimary": false, "transMatrix": { "0": 1, "1": 0, "2": 0, ...
However, the display value is so large that scrolling becomes impractical. The display of arguments in error messages needs to be limited in depth.
This is a nasty test for runes. A working version is this: https://share.sourceacademy.nus.edu.sg/dbquf (replace 5,5 by 500,500)
There is no issue for this program regarding the display of values in the REPL. We would need to find a new program where the display of large values occurs in the REPL.