[dmd-beta] D 2.062 beta

Jesse Phillips jesse.k.phillips at gmail.com
Thu Feb 14 19:39:26 PST 2013


> Things about Configuration files

I'll have to write an article explaining why; I suggest Lua. Important
points for configuration

* Human readable
* Extensible
* The settings need to be translated into a behavior

With Lua you could take several approaches to this.

1. Write code that will locate whatever it is we are locating
    * Using a list of standard locations
    * Giving it access to environment variables
2. Use the approach of overriding being described
    * The override could be done in Lua or in the backend (what you do
with JSON/INI)
3. Having the user make changes

There is room for abuse, but isn't that what programming is all about?

> Looks like one has to learn a new language to use [Lua]

I don't think there is much overhead in what would need to learned for
Lua or Yaml. Even when using JSON one must learn that the system
expects { override : {...}}. It is the ability to describe what you
want in a manner that is easily recognizable.

I'm going hold off trying to suggest solving this problem since I
don't see how any of the suggestions fix the problem which makes me
think I don't know what the problem is; instead here is some
translations of things I've seen:

Environment {
    override = { name = "value", baz = "foo" },
    default = { foo = "baz" }
} -- I don't know what it is overriding
-------------------

Environment = {
    foo = 1,
    bar = 2
}

Environment64 = copy(Environment) -- copy isn't actually defined in std lib

Environment64.bar = 3
--------------------

first = "Joe"
last = "Smith"
age = 17
addr = "123 Road St."

-- 
Jesse Phillips


More information about the dmd-beta mailing list