lua-users home
lua-l archive

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


> You can already solve it with a wrapper, something like;

> local function deprecated(fn, msg)
>   return function(...)
>     print(msg)
>     return fn(...)
>   end
> end

Sure, but that warns when the function is called, not when its name is
used.  If that's what you want, fine, but if I mark soemthing
deprecated, I expect/want a warning when the name is used (one warning
per use at most), not each time the function it resolves to is called.

In particular, I would ideally want a warning even if the function is
never called, such as when doing map over an empty list, and I don't
want multiple warnings if the name is used only once but the function
is called multiple times, such as when doing map over multi-element
list.

While I admittedly haven't actually tried it, I would say the
metamethod way would be the best.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse@rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B