richardhundt / shine

A Shiny Lua Dialect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

One liners

DAddYE opened this issue · comments

Have you though about onliners without end?

You added the nice Lambda Expressions form for example

x = (a) => a * 2 end

What about some with braces?

x = (a) => { a * 2 }

Isn't a bit more readable?

Another alternative will be avoid adding end but I guess will be problematic knowing where the statement ends.

On 4/4/14 8:09 PM, DAddYE wrote:

Have you though about onliners without |end|?

You added the nice |Lambda Expressions| form for example

|x = (a) => a * 2 end
|

What about some with braces?

|x = (a) => { a * 2 }
|

Isn't a bit more readable?

The only issue I have with that is that to return a table, you'd need:

x = (a) => { { a * 2 } }

So, why is the outer {,} pair a block, but the inner a table? It's a
little inconsistent.

The one liner doesn't need end:

x = (a) => a * 2

I need to update the docs to reflect this. There's already an example
here.

Ha, makes sense now. Thanks.