TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Universal configuration language

35 pointsby peterbotondover 10 years ago

11 comments

lifthrasiirover 10 years ago
Any sufficiently complicated configuration language contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. [1]<p>[1] A variation of <a href="https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Greenspun%27s_tenth_rule</a>
评论 #8834735 未加载
usrusrover 10 years ago
Yet another tool to parse one large string into a map of smaller strings. Trouble with configuration files is rarely caused by insufficient syntax features, but insufficient schema validation seems to be a consistent source of wtf-moments: a mistyped key here, a duplicate key there, that&#x27;s what is stealing our time (duplicate key: first definition wins? last definition wins? both get concatenated? doesn&#x27;t matter, if i was aware of having two of them i would have fixed it in a second).<p>What i want from a configuration helper library is nothing less than an internal DSL for specifying the typed structure of allowed&#x2F;expected keys, together with their default values and a short &quot;what is this&quot; description available at runtime. This would be enough to generate nice empty configuration templates and create warnings for unexpected keys (be it from typos or from unexpected duplicates).<p>Fancy syntax features for the configuration files themselves would be only secondary niceties. And candidates for &quot;stupid&quot; preprocessors (&quot;stupid&quot; in that they would not have to know about the appllicaton&#x27;s configuration schema).
评论 #8836020 未加载
moeover 10 years ago
This looks terrible. An &quot;almost-JSON&quot; with... macros? Seriously?<p>What problem is this looking to solve?<p>Why not just use TOML or YAML?
评论 #8834280 未加载
评论 #8834415 未加载
andridkover 10 years ago
Currently, I prefer [toml](<a href="https://github.com/toml-lang/toml" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;toml-lang&#x2F;toml</a>) for configuration. Both languages can be exported to JSON.
评论 #8834163 未加载
andrewaylettover 10 years ago
I am, I&#x27;m sorry to say, unconvinced. I&#x27;m not keen on &#x27;magic&#x27; behaviours like auto-converting of values to arrays -- while the behaviour of the document may be well specified globally, it&#x27;s nice to be able to see what something&#x27;s going to do based on immediate (or even no) context.<p>What I&#x27;m very much liking at the moment is the way Dropwizard uses Jackson&#x27;s YAML (and by extension, JSON) parsing for configuration -- your configuration file maps 1-1 to a class in your application, and Jackson is configured to fail if you&#x27;re either missing a field that&#x27;s not marked as optional or you&#x27;ve got extra fields in your YAML that don&#x27;t map to anything. Type-safety FTW!<p>On the subject of wanting to refer to earlier bits of configuration: if you need to use one value as part of another, your configuration system might not be exposing the right level of detail. Of course, you might not be able to change that.
clarkmover 10 years ago
This has some good ideas, but it&#x27;s very similar to HOCON. I think it&#x27;s more worthwhile to focus on improving the HOCON spec rather than building yet another configuration json superset.<p><a href="https://github.com/typesafehub/config/blob/master/HOCON.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;typesafehub&#x2F;config&#x2F;blob&#x2F;master&#x2F;HOCON.md</a>
bshimminover 10 years ago
The &quot;Automatic arrays creation&quot; bit rather worries me - it strikes me that very often if you have non-unique keys, it&#x27;s because you&#x27;ve made a mistake, so automatically converting that object into an array would probably result in misconfiguration.
_random_over 10 years ago
Looks interesting, however the only reason JSON is generally used IMHO is because it&#x27;s light and compatible. There is no reason to make the new language look like JS (a lame legacy language). It could look like YAML but still support JSON for legacy stuff.
moominover 10 years ago
Doesn&#x27;t Lisp already exist?
评论 #8834046 未加载
评论 #8834347 未加载
jermoover 10 years ago
The Typesafe Config is somewhat similar in the JVM world.<p><a href="https://github.com/typesafehub/config" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;typesafehub&#x2F;config</a>
syskover 10 years ago
<a href="http://xkcd.com/927/" rel="nofollow">http:&#x2F;&#x2F;xkcd.com&#x2F;927&#x2F;</a>