lua-users home
lua-l archive

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


On Thu, 2003-11-27 at 13:57, Daniel Silverstone wrote:
> On Thu, 2003-11-27 at 13:43, Peter Hill wrote:
> > For Lua on a unix system, a file with the "x" flag set should start with a
> > "#! /bin/lua" line (whether the file is Lua text or Lua byte code) followed
> > by the actual file. The Lua interpreter will be piped the data after the
> > "#!" line (which it won't see).
> 
> What fairy wonderland do you live in? the 'shebang' as it is often
> referred to indicates to the kernel (or shell, or whatever feels like
> parsing it) what program to run (and what args to give it) to get it to
> parse the program in question...

Not parse.  *Run*.

<snip>

> It *is* up to the parser (Lua, shell, whatever) to parse out the shebang
> so Lua does handle it in its parser.

No.  It's up to the program called to execute the file to ignore, not
parse.  Shell scripts, for a weak example, aren't parsed at all -
they're executed line by line, and each line is parsed.

> However when it comes to compiled chunks, they're a big lump of binary
> goo, and as such, what you have to do is persuade the kernel how to
> handle them. Linux provides a system called 'binfmt_misc' which does
> this sort of thing.

Linux also supports a system which works just fine:  the shebang.  Which
also has the bonus of working on all the other UNIXes too, and not
requiring root access to make it work.

> As for getting Lua to do clever things based on 'x' attributes etc, that
> would break Lua's spirit of working entirely in the ANSI standard
> wherever possible.

Why would this stop?  If it already ignores #! lines on non-UNIX
platforms, surely making it ignore #! lines in binary lumps on UNIX
platforms is no different?

> The way Lua does things now is (at least in my opinion) __right__ and
> shouldn't be changed to make it rely on system knowledge at all.

It already does rely on system knowledge.  (The ignoring of #! lines in
text lumps.)

-- 
Rob Kendrick, Pepperfish Ltd.         +44 (0)845 226 4146  www.pepperfish.net
PGP signed or encrypted mail welcome                         Key ID: 3651D17A