[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Clean Lua
- From: HyperHacker <hyperhacker@...>
- Date: Sat, 19 Nov 2011 22:47:35 -0700
On Sat, Nov 19, 2011 at 21:53, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>>> Just as Lua is written in "clean C, the common subset of Standard C
>>> and C++", one can write one's new programs in "clean Lua, the common
>>> subset of Lua 5.1 and 5.2".
>
>> I don't get the discussion.
> The intended point is just the one sentence quoted above.
>
>> …
>> The other observation I recently had on maillinglists, its usually
>> not very productive when the topic is about how others should code,
> I was basically reporting on how I code. I don't care about how others
> code.
>
>> …
>> So can we just stop bickering about 5.2 and switch over to get some
>> cool stuff done?
> For the first few replies after I posted I was quite sorry I did, since
> some people did "bicker about" 5.2 instead of helping to pin down
> Clean Lua (which I actually thought was a cool idea, sorry you didn't
> seem to like it much late on a Saturday night).
>
> Then came some very enlightening posts by Petite Abeille, David
> Manura and Steve Donovan. I hope your reaction to my post did
> not stop you from reading theirs.
>
> Dirk
>
I don't understand the purpose of "Clean Lua". With C, there are a lot
of things you can't rely on - compiler/preprocessor features/bugs that
may or may not be present, language extensions, the presence of header
files and libraries, etc. There can be a lot of differences between C
as interpreted by one platform and C on another. This IMO is one of
C's biggest weaknesses, and the point of "Clean C" is to avoid as much
of those uncertainties as possible, so as to ensure your code compiles
on as many platforms as possible.
Lua doesn't have this issue. For the most part, Lua here is Lua there,
and if you are dealing with a platform that has some incompatible
changes, it's probably different enough that your code would already
need some major changes anyway. The only difference most people will
have to worry about is Lua 5.1 vs Lua 5.2 vs LuaJIT, which are all
extremely similar.
To me it seems like "Clean Lua" means "Lua [5.1|5.2|JIT] with a couple
of wrappers to emulate some [5.1|5.2|JIT] behaviours if desired,
without relying on features specific to one of the three". Don't rely
on __gc for tables or any LuaJIT extensions and know how to use both
setfenv() and _ENV, and you're fine.
Plus, like others have mentioned, it's not as important to be
compatible with multiple versions, since you can have several versions
installed, or if embedding Lua in a program, you can keep that program
at whatever version you please.
--
Sent from my toaster.