Is there a way to get the (correct) line and column info from the form {a a} when a is undefined?
E.g.
(try (sci.core/eval-string " a ") (catch Exception e (ex-data e))) ;=> {... :line 1 :column 3} ; correct
(try (sci.core/eval-string "{a a}") (catch Exception e (ex-data e))) ;=> {... :line nil :column nil}
(try (sci.core/eval-string "(try
{a a} (catch ^:sci/error Exception e (throw e)))") (catch Exception e (ex-cause e))) ;=> {... :line 1 :column 1} ; incorrect, always 1 and 1
In babashka you can see the above as well:
bb -e "
{a a}
"
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: Could not resolve symbol: a
Phase: analysis
Clojure itself also seem to have issues with reporting this kind of error, but it would be nice if Sci could do thisOnly seq forms (lists) have positional metadata so in this case, unfortunately not
It seems Clojure has the same behavior:
user=> {:a (+ 1 a)}
Syntax error compiling at (REPL:1:5).
Unable to resolve symbol: a in this context
user=> {:a a}
Syntax error compiling at (REPL:0:0).0:0 means: I don't know, I think
Ok too bad, thanks for confirming
It is a different case, but it is interesting that this gives accurate line information as it complains about a duplicate key. I guess that's an error from one level before, the edn parsing
(sci.core/eval-string "
#{ a a }")right, that'a coming from the reader