lua-users home
lua-l archive

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


On Mon, May 25, 2020 at 2:43 AM pocomane <pocomane_7a@pocomane.com> wrote:
>
> On Mon, May 25, 2020 at 10:21 AM Ray <emacsray@gmail.com> wrote:
> > On every discussion thread I can find about 5.4 <const> <close>, there
> > are great piles of complaints about the horrible syntax.
> > Hope the syntax can still be fixed, otherwise it will assuredly hamper
> > the adoption.
>
> Not for 5.4, I do not think so.
>
> > Oh, does `x:const = 1` imply `local`? This syntax seems nice!
>
> Yes but it is not possible since it already means something in lua
> (call the const method of x). I did not realize this when I made my
> previous examples, sorry.

https://github.com/lua/lua/blob/master/lparser.c#L1107

      case ':': {  /* ':' NAME funcargs */
        expdesc key;
        luaX_next(ls);
        codename(ls, &key);
        luaK_self(fs, v, &key);
///////////// The  functioncall ::= prefixexp ‘:’ Name args syntax
(the next token is '(' '{' or string) does not conflict with the
proposed `var:const = `
        funcargs(ls, v, line);
        break;
      }