[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Namespace pollution in lua.h
- From: Adolf Mathias <dolfi@...>
- Date: Wed, 16 May 2001 08:00:51 +0200
Garth Dighton wrote:
>
> Unfortunately, you cannot always trust this rule, even with very
> commonly used products. The company I work for uses the variable
> "Status" as an argument to one of the API's in our product. Perfectly
> reasonable. Guess which very common Unix library #defines this?
>
> ...
>
> X Windows #defines Status as int (for use as a return type)
>
> Which means, of course, that no one can ever #include our product's
> headers after the X windows headers.
X (and Xt: Xt typedef's Object!) is certainly the greatest name space
polluter on earth. When I remember well, it's even worse than Windows.
Best is to avoid contact with it almost entirely.
A suggestion to the authors of Lua: If you should ever have some spare
time, you might think about namespaces and a Pascal-like with statement,
or some analogon to Postscript's begin operator that pushes a dict onto
the dict stack. Of course, Lua is statically scoped, so this would
behave differently, i.e. bindings would take place at compile time.
Dolfi