lua-users home
lua-l archive

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


Hi Luiz,

> On Jan 3, 2015, at 7:01 PM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> 
>> For the longest time, I use -DLUA_COMPAT_ALL in that script's CPPFLAGS, for maximum compatibility across Lua releases.
> 
> LUA_COMPAT_ALL was introduced in Lua 5.2.0, three years ago, not so long ago...
> However, the name LUA_COMPAT_ALL encompass too much and is not very precise.
> So we changed it in 5.3 to be precise about which version we want compatibility.
> 
>> for Lua 5.3.0rc3 I have to use different flags (-DLUA_COMPAT_5_2, others?).
> 
> Define LUA_COMPAT_5_2 for compatibility with Lua 5.2.
> Define LUA_COMPAT_5_1 for compatibility with Lua 5.1.
> 
> The Makefile explicitly defines LUA_COMPAT_5_2 and not LUA_COMPAT_5_1,
> so all 5.2 features are turned on by default and all 5.1 features are
> turned off by default.
> 
> The 5.2 features that are controlled by LUA_COMPAT_5_2 are deprecated.
> 
> For new projects, we recommend that LUA_COMPAT_5_2 is left undefined
> to help migration. Individual 5.2 features can be turned on by
> defining these:
> 
> #define LUA_COMPAT_MATHLIB
> #define LUA_COMPAT_BITLIB
> #define LUA_COMPAT_IPAIRS
> #define LUA_COMPAT_APIINTCASTS
> 
> As you can see, not much.
> 
> For details, see luaconf.h.

Thanks for the detailed rationale, which makes sense.

I'd like for my package releases to be compatible with the standard configurations
of Lua 5.1 through 5.3 (plus LuaJIT), so I think I should follow the flags passed
by 'make posix' in each case.

That means -DLUA_COMPAT_ALL when building a 5.2 lua, and -DLUA_COMPAT_5_2 for 5.3
AFAICT.

Where it might be more robust to be compatible with each release with no
compatibility enabled, I'm not sure I want to maintain all the extra glue in each
of my packages instead of taking advantage of the existing compatibility options
in Lua itself.  Unless you think that's a false economy that will eventually make
more work for me in the long term?

Cheers,
-- 
Gary V. Vaughan (gary AT vaughan DOT pe)