tech-userlevel archive

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

Re: proplib and the jet age



Am 05.01.2013 um 00:33 schrieb David Holland 
<dholland-tech%NetBSD.org@localhost>:

> On Fri, Jan 04, 2013 at 08:44:06PM +0100, Jan Danielsson wrote:
>>   I somewhat recently migrated one of my own projects to use lua
>> scripts as configuration files rather than a custom "key=value"-pair
>> type configuration.
>> [...]
> 
> Obviously you do what you need to do (for whatever reasons)... but do
> keep in mind that in general, using Turing-complete languages for
> configuration is a bad thing.

This is just a statement and you should back it by facts. or rather, explain 
why you think a turing-complete language is bad for configuration.  It could be 
that the negative effects have already been mitigated, plus Lua can be made 
less turing-complete that many think.

Just to recap a few things:

- Lua can easily be made not Turing-complete
  - The execution count (number of instructions executed) can be limited
  - Endless loops can be prevented
  - Endless tail recursion can be prevented
  - Memory exhaustion can be prevented
  (All this is mentioned in Patric Rapin's article on using Lua as a protocol 
language)

Other facts are:

- Lua does not have access to memory of the host program
- Lua can not call arbitrary functions
 
The valid downside I see is that a configuration in Lua can not be parsed by 
e.g. a GUI tool, but it has always to be executed to be evaluated.  This can 
complicate things when the configuration is to be read by a tool like sysinst 
that would present the current configuration in a menu oriented fashion.  It is 
not impossible, though, and it has been done before.



Home | Main Index | Thread Index | Old Index