TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

CONL: "Markdown" for your config files

70 点作者 kretaceous20 天前

18 条评论

nickm1219 天前
&gt; it’s really hard to comment out a line in a JSON file, because you end up with an extra trailing , on the previous line<p>Every other language has figured this one out: just support trailing commas. JSON5 supports comments <i>and</i> trailing commas.<p><a href="https:&#x2F;&#x2F;devblogs.microsoft.com&#x2F;oldnewthing&#x2F;20240209-00&#x2F;?p=109379" rel="nofollow">https:&#x2F;&#x2F;devblogs.microsoft.com&#x2F;oldnewthing&#x2F;20240209-00&#x2F;?p=10...</a> <a href="https:&#x2F;&#x2F;json5.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;json5.org&#x2F;</a><p>&gt; The first version of CONL used # as a comment token, but I quickly ran into issues. URLs contain #, so my next version...<p>Every other language has figured this one out as well. Wrap strings in quotation marks.<p>&gt; That led to a data-model where each value is one of scalar|list|map (Compared to JSON’s null|bool|number|string|object|array, this felt good).<p>I&#x27;m not sure what a &quot;scalar&quot; is in CONL (is it always a string?) but a config file format having fewer types than JSON does not feel good to me. Even JSON&#x27;s hand-wavy &quot;number&quot; type is problematic (whether &quot;1&quot; is an integer or float or some some other type is implementation-defined). TOML got it right to distinguish integers from floats. TOML got this right.
评论 #43812424 未加载
0xbadcafebee19 天前
Those who don&#x27;t learn their history are doomed to find new and innovative ways to repeat history.<p>If you&#x27;re older than 40, you remember that there did exist an aeon, long, long ago, when people did not use data object serialization formats as config files. When config files were written not to be easy to parse, but to make it easier for human beings to configure software. When nobody believed there was one single good way to do everything. When software was written not to aid computers, but to aid humans.
评论 #43811261 未加载
评论 #43811607 未加载
评论 #43810396 未加载
simonask19 天前
I&#x27;m sorry, nothing beats KDL in terms of readability and friendliness. I&#x27;ve been using it in personal projects for a while, and it is just so pleasant. I wish it saw way more widespread usage.<p><a href="https:&#x2F;&#x2F;kdl.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;kdl.dev&#x2F;</a>
评论 #43811528 未加载
评论 #43811918 未加载
评论 #43810378 未加载
networked19 天前
&quot;An INI critique of TOML&quot; this is inspired by was discussed in 2023: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=37595766">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=37595766</a>. It received a lot of criticism, particularly for invoking Postel&#x27;s law.
评论 #43810196 未加载
martypitt19 天前
HOCON is a worthy contender in this space - I wish it got more airtime. (We use it extensively).<p>JSON superset, optional quotes for keys, sensible string handling, comments, automatic env variable handling, variable references.<p>It&#x27;s not perfect (all sufficiently powerful configuration language has quirks), but I love it.
评论 #43811341 未加载
kiitos20 天前
&gt; CONL uses indentation for structure.<p>Oops.
评论 #43809539 未加载
rsyring20 天前
Seems better to run with something everyone basically already knows¹ than to invent a new format with relatively zero support?<p>1: <a href="https:&#x2F;&#x2F;github.com&#x2F;crdoconnor&#x2F;strictyaml">https:&#x2F;&#x2F;github.com&#x2F;crdoconnor&#x2F;strictyaml</a>
aburdulescu19 天前
Shameless plug :)<p>I&#x27;ve also been playing around with a configuration format, for similar reasons, although my approach is to make it easy(enough) to read&#x2F;parse for both humans and machines.<p>HN post: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42516608">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42516608</a><p>Any feedback is welcomed, but keep in mind is just a toy project which has only one user in mind(me), no plans to conquer the world or solve the config format problems for all :)
qznc19 天前
I like <a href="https:&#x2F;&#x2F;nestedtext.org" rel="nofollow">https:&#x2F;&#x2F;nestedtext.org</a> because it doesn’t try to be clever and everything is just a string.
Rucadi19 天前
Personally I&#x27;ve found great success using NIX as a programmable config file, and outputting json to be read by the application.
EasyMarion19 天前
Really like the philosophy here. Keeping config formats minimal and text-first (rather than trying to be &#x27;clever&#x27; with types or logic) feels underrated these days. CONL looks like it hits a nice sweet spot between human-editable and machine-parseable without drifting into &#x27;just use a programming language&#x27; territory.
stared20 天前
Be like:<p>- don’t mind the peculiarities of formats used for config<p>- create a format where semicolons denote comments (just… doesn’t look right)
评论 #43810181 未加载
评论 #43809634 未加载
Hyperlisk20 天前
Nice! I share a similar set of thoughts and ideals around configuration languages and I&#x27;m working on one as well. Mine has a very similar syntax, so you might be interested! You can find it if you dig through my comments.
throwaway15019 天前
So everyone now wants a configuration file format named after them, isn&#x27;t it?
ChrisArchitect20 天前
Earlier: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=43804489">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=43804489</a>
dcreater20 天前
Yes the existing formats have issues. Highly suspect that yet another format is the answer.
bmandale20 天前
json but:<p>comments and<p>commas are allowed at the end<p>thoughts?
评论 #43809487 未加载
suprjami20 天前
Sigh. <a href="https:&#x2F;&#x2F;xkcd.com&#x2F;927&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xkcd.com&#x2F;927&#x2F;</a>
评论 #43809785 未加载
评论 #43809874 未加载
评论 #43815794 未加载