by seagreen · 6y ago · 0 comments
For example:
$ erl
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:8:8]
[ds:8:8:10] [async-threads:10] [kernel-poll:false]
Eshell V9.2 (abort with ^G)
1> 2 + 2
1> 2 + 2.
* 2: syntax error before: 2
1> 2 + 2.
4
Note the trailing whitespace(!) after the last `2 + 2. `, necessary for the result to be printed.I was coming from Haskell which has its own very serious tooling and ergonomics problems. Trying Erlang made me realize things could be even worse. My internal model in my head of language designers/promoters is COMPLETELY wrong, I have absolutely no idea how people could spend time promoting languages with such strange tooling to a general audience with any expectation that it will work.[1]
[1] Not to say that these languages/tools aren't awesome. Trailing whitespace matters semantically absolutely not at all. But if you're trying to promote a language with meaningful trailing REPL whitespace to a general 2020 audience there is some terrible mismatch between your expectations and your actual chance of success.
To get the effect you wanted in the you needed a `.`:
1> 2 + 2
1> .
4
That is, if you really wanted it split over multiple lines.The syntax error is indicated as being on line 2 (though not obviously on line 2) with the prefix to the error:
* <line number>: <syntax error information>
What you've essentially typed in your first example is (replacing the newline with a single space): 1> 2 + 2 2 + 2.
You'd expect an error from that since there is no operator between the second and third 2. Even placing a comma would've been enough: 1> 2 + 2
1> ,2 + 2. ;; this is weird to do, but valid
4
The shell expects a period terminating an expression before it parses it. This permits entering multi-line expressions without doing anything special (you don't need a special "I'm going to continue on to the next line please don't parse this one" backslash, for instance).My argument is wrong then-- this isn't shockingly bad anything, just a little quirkiness.
It's always been correct by line number for me, but I usually have to read that and the line above/below to understand what my actual errors are.
Eshell V10.4 (abort with ^G)
1> 2+2
1> 2+2.
* 2: syntax error before: 2
1> 2 + 2.
4
2>
Anyway, Python replaces the prompt ">>> " with "... " if the input is mid-statement, and I suppose it would be nice if Eshell did the same thing.