lua-users home
lua-l archive

Re: Lightweight function syntax (again) Re: [ANN] Lua 5.2.0 (alpha-rc2) now available

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


On Tuesday, November 23, 2010, Axel Kittenberger <axkibe@gmail.com> wrote:
> Optically I like pipes too, since they also remind me of their use in
> the shell to "tie things together". Their main problem tough is they
> cannot nest, as the begin and end token is identical. One could say,
> if you want nesting use full function syntax please, but well maybe
> someone has a problem with it not working.
>
> | a, b => | x => x* x * x | (a+b) |
>
> -> supposedly a real challenge for the parser.
You're of course right. I had taken this fact into account while
writing the previous post, but I removed it while refactoring, and
forgot about it afterwards.
 | args ( expression )
 | args [ statements => expression ]
Variations of the above expressions are the only legal possibilities
with one character tokens.
@| args => expression |
@| args : statements => expression |
 is also valid at the expense of an added symbol. A function of he
second kind with no arguments becomes with the first or second syntax:
 | [ statements ]
 @|: statements |
Which isn't too bad.
Kind regards,
-- Pierre-Yves

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