lua-users home
lua-l archive

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




On 2019-05-30 1:15 p.m., Xavier Wang wrote:


Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br <mailto:lhf@tecgraf.puc-rio.br>> 于2019年5月30日周四 上午8:38写道:

    Lua 5.4.0 (alpha-rc1) is now available for testing at
    http://www.lua.org/work/lua-5.4.0-alpha-rc1.tar.gz
    All feedback welcome. Thanks.
    --lhf


Hi Luiz, is there any plans to support <toclose> and <const> (i.e. the annotation syntax) on the function parameters?

e.g.

function foo(<tobeclose> f, <const> cfg)
  -- use f and cfg
end -- the f will be close and cfg can not modify in the function body

the most way to use "const" in C is use it as function parameter qualifier. So does Lua plan to support it?


Lua is nice in that it supports shadowing. So you can just do:

function foo(f, cfg)
  local <tobeclose> f = f
  local <const> cfg = cfg
end

P.S. the new syntax is ugly, indeed :-(


--
regards,
Xavier Wang.