lua-users home
lua-l archive

Re: Why Lua allow an extra comma after the last element of a table?

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


2013年3月10日 William Ahern <william@25thandclement.com>:
> for (;;) {
> again:(void)0; // valid void expression which documents intent
> }
>
> Note that the `for (;;)' is also using null statements. The void expression
> pattern in the last example assures the reader that you didn't accidentally
> omit a statement, which outside of for loop expressions is probably the
> first conern that comes to mind when you spot a lone semicolon.
>
> Lua has null statements, though not void expressions:
IMHO short comments better document the absence of an expression than
a void expression. And Lua has comments.
C: for (;;) /* no-op */;
Lua: repeat --[[ no-op ]] until the_end_of_time

AltStyle によって変換されたページ (->オリジナル) /