[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: boolean operators
- From: "Andy Stark" <AStark@...>
- Date: Thu, 21 Sep 2006 12:09:02 +0100
Roberto Ierusalimschy wrote:
> May I ask you (and others) why you need boolean operators in Lua? (This
> is not a rhetorical question. I really want to know what uses boolean
> operators may have in Lua.)
A common response to this kind of question on this list is that you can
always add bitwise functions (or other special functions) in C if you have
a need for them. We often seem to miss the point that the majority of
people who now have Lua on their computers (via Lightroom, modo, WoW,
Baldur's Gate, etc) have no possibility of modifying the C code in the
embedding application because the source code is proprietary.
In theory, anything that can be written in off-the-shelf Lua can be used
in any application that embeds Lua. If there are some basic programmer's
tools (like bitwise ops) missing from standard Lua then it limits the
possibilities for the host application. For example, consider Flash SWF
files - compressed bitstreams that can't be parsed easily without bitwise
ops. If you wanted to write an extension for Modo, say, to read in SWF
files then it would currently be very difficult to do this in Lua.
The main counterarguments I can see coming are:-
1. The programmers of the host app have responsibility for extending Lua
as necessary.
2. Most people using an embedded Lua purely for scripting probably
wouldn't know what bitwise ops are for.
3. An interpreted language would be too slow to do anything as low level
as this in a big way.
I would answer by saying:-
1. The host app programmers might not anticipate what scripts will be used
for. Lua would be a bit more friendly to embedders if it limited their
responsibilities in this matter.
2. An advanced Lua programmer could write the complex libraries for SWF or
whatever - the scripter merely has to make use of the API.
3. Slow is better than nothing and the arrival of systems like LuaJIT for
Intel Mac/PC means that the major application developers (Adobe, etc) have
access to a very fast Lua engine for the platforms they support.
Basically I am saying that library code written in pure Lua potentially
extends the abilities of every piece of software that embeds Lua. It's
better, therefore, if programmers don't "hit the wall" with things like
bitwise ops that are very difficult to simulate with standard arithmetic.
&.
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared
by MailMarshal.
The Blackpool Sixth Form College.
#####################################################################################