lua-users home
lua-l archive

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


On 21/09/2010, at 7:58 PM, Jonathan Castello wrote:

> On Tue, Sep 21, 2010 at 12:48 AM, Benoit Germain <bgermain@ubisoft.fr> wrote:
>> <snip> ... maybe others have a different opinion on the subject?
> 
> Personally, I favor Ruby's approach, which I believe uses newlines as
> an effective syntactic hint to determine what your intent probably
> was. It has optional semicolons, which you generally need to use if
> you want to squish two statements onto one line (since as mentioned,
> newlines are used as hints).
> 
> In most languages I've seen, it's uncommon to put multiple stand-alone
> statements on the same line. Why use a semicolon where a newline would
> do?

Perhaps because it's not uncommon to put a single statement on several lines?  For this very contrived example:

call_a_function_with_a_long_name(and_a_long_argument)
  ("and_call_the_result"):sub(and_so_on)

Lua 5.1 would complain and I understand Lua 5.2 would interpret it as one statement.  What would Ruby do?

In both 5.1 and 5.2 if I want it to be two statements, then I can use a semicolon, but I if I understand what you propose, I can't break my long line at that point (I know, I could break it other places) and have it be interpreted as a single statement - unless we have a continuation character like FORTRAN and VB.

(I'm not arguing for or against any of your, Benoit or Juris's ideas, I'm just being a nitpicker.  I am against a continuation character though!).

Cheers,
Geoff