lua-users home
lua-l archive

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


Reuben Thomas <rrt@sc3d.org> writes:
> I'm doing a little bit of work on my autoconf-archive macros for
> detecting Lua, ax_lua.m4.

I notice, BTW, that the zile Lua header/lib detection fail on Debian
(and presumably Ubuntu?)...

It's actually easy to handle Debian because it uses pkg-config for Lua:

   have_liblua=no
   PKG_CHECK_MODULES([liblua], [lua5.1], [have_liblua=yes], [:])
   if test $have_liblua = no; then
     # Check for Lua headers and libs using various version prefixes,
     # setting liblua_CFLAGS and liblua_LIBS like PKG_CHECK_MODULES does.
     ...
   fi


[From here:
https://github.com/snogglethorpe/snogray/blob/master/configure.ac
]

>
> However, I'm not aware of much code written this way (though again, it
> might become much more common with 5.1-5.2).

I suspect it's because there's a lot of time between Lua (non-minor)
versions, and many Lua projects are small and not really maintained
actively long enough to last past a version change.

There _do_ seem to be a lot of libraries out there written for Lua 5.0
that kinda-sorta work on Lua 5.1 (and which haven't ever been updated
for 5.1).

> I was wondering whether this multi-version support is common-place, or
> whether, on the other hand, it is considered bad practice? I was
> considering removing the range support and replacing it with a macro
> which simply requires a specific version...

I wouldn't consider it bad practice.  I know that once 5.2 is
released, I'll probably try to support both it and 5.1 -- 5.2, because
it will be the current version (and a nice evolution), and 5.1 because
that's what LuaJIT targets (and it sounds like LuaJIT will take some
time to support 5.2 features)...

On systems like Debian or Ubuntu that make it easy to install
different versions, it's probably not a big deal to require a specific
version, but I imagine being flexible will be more friendly to people
installing on less flexible systems.

> For me, the risk of subtle bugs militates against trying to write code
> that supports more than one version of Lua

Are there any changes 5.2 that are likely to have that effect?  The
only thing that comes to mind is the additional metatable support
(__len etc) in 5.2, which of course would simply be unused in 5.1...

-jmiles

-- 
Everywhere is walking distance if you have the time.  -- Steven Wright