[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Could we have elegant version requirement from 5.3 on?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 26 Mar 2014 08:46:38 +0200
There seems to be no way of making Lua code say politely:
"This program requires Lua 5.3" when running under Lua 5.2.
Instead, one gets a nasty message like
./myprog.lua:28: unexpected symbol near '&'
as soon as it hits a bitwise operator.
But maybe it is not late for next time round. We are already
ignoring one leading `#` line. We could equally well ignore
all leading `#` lines and tag some of them as expressions to be
asserted _before_ proceeding to lexical analysis of the file.
This would allow elegant version control and more.
E.g.
#! /usr/bin/env lua
#@ _VERSION >= 6.0
#@ bit32
When Lua 5.3 runs this program, or Lua 6.0 runs it without
having preloaded a bit32 library, the rest of the file would not
even be looked at.