lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2015-06-18 20:43 GMT+02:00 Tom N Harris <whoopdedo@whoopdedo.org>:
> On Thursday, June 18, 2015 01:12:27 PM Dirk Laurie wrote:

> If the interpreter is going to accept expressions then it should do so without
> quirky corner-cases.

None of these is quirky or a corner case. All behave exactly as documented.

>> 1 + math.random()
> 1.8401877167635

Complete expression on one line --> evaluated and printed.

>> 1 + math.random(
> stdin:1: unexpected symbol near '1'

Code that cannot possibly be a prefix to a valid function body --> error

>> math.random()
> 0.39438292663544

Complete expression on one line --> evaluated and printed.

>> math.random(
>>> )
>>

First line is not an expression but could be a prefix to a valid function
body --> another line is added.
Second line completes it. It is a function call --> performed but
return values are discarded.