|
That would be a simple case of operator precedence.Same "argument" could be, any addition needs brackets otherwise a*b + c would be (a*b) + c...
Anyway, its not that I ever wanted to use "a":rep(5) in a practical program, or it was a huge issue to do brackets even if so.On Thu, Sep 11, 2014 at 8:59 AM, Hao Wu <wuhao.wise@gmail.com> wrote:
On Wednesday, September 10, 2014, Axel Kittenberger <axkibe@gmail.com> wrote:The question should rather be, why do you need brackets for this?I'd expect'5':rep( 10 ).to work.You need the parenthesis becausefoo"bar":rep(5) will be translated to(foo("bar")):rep(5)On Wed, Sep 10, 2014 at 7:04 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:2014-09-10 17:38 GMT+02:00 Robert McLay <mclay@tacc.utexas.edu>:
> Thanks all. It is clear that this is safe to use. At least until there is
> a good reason to remove support for it in later releases.
>
> I get that ("5",x,y) is going to return "5". What I don't get is why then
> is:
>
> s = '5':rep(4)
>
> does not work but
>
> s = ('5'):rep(4)
>
> does.
prefixexp ::= var | functioncall | ‘(’ exp ‘)’
functioncall ::= prefixexp args | prefixexp ‘:’ Name args
Since '5' is neither a variable nor a function call, it needs parentheses.