On Fri, May 30, 2014 at 04:25:40PM +0800, Nala Ginrut wrote: > It's not a problem for Ecmascript, because its statement has to be ended > with semicolon. So it's easier to detect the minimum compiling unit in > REPL. ECMAScript uses semicolon insertion---semicolons are optional, but this can lead to ambiguities. For example: function foo() { return { foo: "bar" } } `foo` will return undefined, not {foo:"bar}, because it inserts a semi-colon after `return`; the way to get around this is to put the beginning curly brace of the object literal on the same line as `return`, in which case the expression would be completed by the closing curly brace of the object literal, semicolon optional. If you take a look at Node.js' REPL, you can see how it handles line continuations. So this problem would exist for more than just Lua. But is it actually a problem? Ctrl+D, if needed to end an expression, would represent EOF; I don't know if this is valid in Lua, but in ES, if an EOF (or semicolon) is encountered during the parsing of an expression that requires more input, then it is a syntax error---the compiler and REPL would handle it in the same way, but the REPL would just display a PS2-style prompt (which readline seems to do as "..." right in Guile 2.0). It could be my ignorance of Lua. :) -- Mike Gerwitz Free Software Hacker | GNU Maintainer http://mikegerwitz.com FSF Member #5804 | GPG Key ID: 0x8EE30EAB