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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

CCL: Categorical Configuration Language

100 点作者 SchwKatze5 个月前

22 条评论

theamk5 个月前
That&#x27;s a lot of words to describe a very simple syntax: name=value pairs, with line continuation using whitespace.<p>Basically RFC822 email headers, or Debian Control File Format [0] but with &quot;=&quot; instead of &quot;:&quot;, and without dedicated comment character.<p>The biggest problem with this format is that a lot of things are left for the app, so each app will have its own way to implement lists, bools, line wrap support.. Even something like &quot;value override&quot; is left to program implementation. Don&#x27;t expect YAML&#x2F;JSON&#x2F;XML-style automated validators&#x2F;linters, each program will need its own bespoke parser&#x2F;generator.<p>[0] <a href="https:&#x2F;&#x2F;www.debian.org&#x2F;doc&#x2F;debian-policy&#x2F;ch-controlfields.html#syntax-of-control-files" rel="nofollow">https:&#x2F;&#x2F;www.debian.org&#x2F;doc&#x2F;debian-policy&#x2F;ch-controlfields.ht...</a>
评论 #42620064 未加载
评论 #42667135 未加载
mightyham5 个月前
I really like the conciseness of this syntax. The language seems very well thought through.<p>That being said, I&#x27;ve been working with NixOS recently and it&#x27;s made me reconsider what is useful for a configuration language. In many reasonably large software projects, where configs become very complex, config reuse (in other words templating or meta-configuration) becomes an increasingly helpful feature. Nix configs are great because it&#x27;s not just a config, but a full blown purely functional language for manipulating the config. It&#x27;s intuitive and powerful once you get the hang of it, and I sometimes find myself wishing I could use it when I have to work with yaml, json, etc.
评论 #42667268 未加载
nickm125 个月前
Everyone is entitled to scratch their own itch, but this seems like the most useless configuration language I&#x27;ve ever seen.<p>Take the &quot;fixed point&quot; example, where you have a boolean setting which one file says should should be &quot;yes&quot; and the other says it should be &quot;no&quot; and the language semantics composes that into a list with both values. For what boolean setting does this make sense?<p>The article says &quot;Overrides are not a problem because you keep both values. And you can decide what to do with them: keep only the first, keep only the last or use some smart logic to combine both of them. You’re the boss.&quot;<p>If you need custom logic in your application determine the setting to use, how is this language helping you?
评论 #42667744 未加载
评论 #42674564 未加载
4ad4 个月前
Compositionality is paramount and category theory guarantees compositionality, but the author&#x27;s criteria for what entails a good configuration language are woefully naïve.<p>Configuration is not about describing data, it&#x27;s about control. Control over a system made of impure, effectful parts.<p>Configuration is a matter or <i>programming</i> a mutable computer, i.e. a way to specify the composition of effects that you want.<p>The configuration language is agnostic over the systems it controls, therefore it must provide semantics that preserve morphism in any of its interpetations. The language must be rich enough to accomodate for this. It is not enough to have one semantics.<p>Moreover, it must be rich enough to describe its own models. Yes, the interpretation of it by arbitrary systems must be expressible in the language itself in order to be meaningful and to preserve consistency with regard of its interpretations. In practice, this is done through types.<p>Additionally, configuration is a <i>global</i> activity, it&#x27;s applied to the whole system, with many people changing conflicting aspects of it. Just like with any large evolving program, abstraction and typing are required for software engineering reasons alone.<p>Coincidentally, CUE is also a monoid, but it is more than that, it is a complete Heyting algebra (or a complete Boolean algebra in the case of closed world assumption), these objects also form very rich categories.<p>Another way to look at CUE is to view it as a semantic domain for the denotation of arbitrary types of arbitrary languages. It&#x27;s suitable for this because it&#x27;s a coherence space (Girard). All CUE operations are closed, preserving the structure of the space.<p>One interesting aspect of author&#x27;s effort is that even if he was so naïve, category theory led him to a path that is correct. What he did is <i>incomplete</i>, a monoid does not suffice for a configuration language, but a monoid is <i>required</i>. This is saying something.
评论 #42682394 未加载
trelliscoded5 个月前
The equal sign is a required character for anything base64 encoded, which includes some things you’d expect to be in a config file, like ssh public keys and x509 certs.
efitz4 个月前
“Data” has syntax (structure), semantics (meaning), and often needs references (to other parts of itself or other data).<p>There does not exist a perfect configuration language because whether and to what extent each of these capabilities are supported is a subjective trade-off, and reasonable people with different problems might reasonably want different trade-offs.<p>I like config languages that allow variables and references, so that eg if I change the root path, I just have to change the $ROOT variable near the start of the file and 20 other sub-paths just reference the new $ROOT.<p>I also like semantics with my syntax, because lots of time I care about dstip but not srcip or vice versa; IP lets me parse for accuracy but not for meaning&#x2F;usage.<p>I hate encoding meaning in whitespace; it trades away robustness in duplication in favor of being more human readable. This probably comes from lots of NNTP and XMODEM and 7-bit ASCII battle scars. But reasonable people can disagree.<p>On the other hand, I think it is a valuable learning exercise to write your own DSL for some common problem space and share it, IF you listen to and internalize the feedback others write about it rather than just filter out anything that isn’t adulation.
Bost4 个月前
Have a look at &quot;Code is Data &#x2F; Data is Code&quot; <a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Homoiconicity" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Homoiconicity</a> And then see how it&#x27;s done in real life: <a href="https:&#x2F;&#x2F;guix.gnu.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;guix.gnu.org&#x2F;</a>
cies4 个月前
Nice! I really like a fresh take on anything.<p>It&#x27;s been said to be like RFC822 or Debian Control File Format in the comments here, I&#x27;d like to add like x-www-form-urlencoded. At work I use this a lot as it is what browsers submit. It&#x27;s List&lt;String, List&lt;String&gt;&gt;, so keys may occur more than once. We standardized on little language for the keys that allows us to submit structured forms. (Many libraries prescribe a language for this, Rails does too; our keys look like &quot;.location.space[2].name&quot; for &quot;{location:{space:[null,null,{name=VALUE_AS_STRING}]}}&quot; in json).<p>Some years ago I wrote a TOML parser in Haskell. Because parsers a fun to write in Haskell, and I needed one.<p>Since we deploy with AWS&#x2F;Fargate (Docker) the config is passed as JSON k-v pairs that are then set as ENV VARs in the container (following one of those 12factor principles). So it seems I cannot dictate the config file format.
jcarrano4 个月前
Essentially a stripped-down ini where you have to code any additional functionality and you will never have any tooling because basic things (like comments) are not standardized.<p>For the use cases mentioned in the article, I have used JSON with schemas and JSON-merge and JSON-patch quite effectively. VScode supports schemas so it will help you edit the file without making mistakes. You can use JSON merge to combine global and local configs and you could even use custom fields in the schema to indicate metadata, for example, that a key represents an upper limit so the lowest value should be considered when merging.
评论 #42668427 未加载
worthless-trash5 个月前
Every configuration language that is not code ends up being wrong in multiple ways. We will never learn.
评论 #42667332 未加载
junon4 个月前
What a delightfully arrogant article, to the point I believe it to be satire (stopped reading at section headers, perhaps I missed the punchline).<p>TOML is by far the most stripped down and easy to understand configuration format I&#x27;ve ever used, allowing just enough syntactic sugar to be useful without changing semantics. The fact it&#x27;s made by Tom is meaningless, so its flagrant dismissal is silly to me.<p>Meanwhile, the proposed configuration format sounds like a nightmare to read. There is still clashing syntax, offloads all of the parsing work to the software (which means now you have the same config format with multiple different ways of interpreting values), restricts usage of certain characters with no way of escaping them (someone else mentioned base64), and otherwise requires that you recursively parse it for nested KVs rather than constructing the final in memory structures in a linear pass, adding a layer of indirection prior to parsing.<p>Not to mention, I really get turned off by this sort of pious writing style.<p>No thanks. Lots of reasons to dislike config formats we&#x27;ve seen before but this doesn&#x27;t solve anything in my eyes.
cirwin4 个月前
I’ve been working on a configuration format [1] that looks surprisingly similar to this!<p>That said, the expectation in CONL is that the entire structure is one document. A separate syntax for multiline comments also enables nice things like syntax highlighting the nested portions.<p>I do like the purity of just a = b, but it seems harder to provide good error messages with so much flexibility<p>1: <a href="https:&#x2F;&#x2F;github.com&#x2F;ConradIrwin&#x2F;conl">https:&#x2F;&#x2F;github.com&#x2F;ConradIrwin&#x2F;conl</a>
kukimik4 个月前
This, for a number of reasons, reminds me of the Tree format, see <a href="https:&#x2F;&#x2F;hackernoon.com&#x2F;tree-ast-which-crushes-json-xml-yaml-toml-etc" rel="nofollow">https:&#x2F;&#x2F;hackernoon.com&#x2F;tree-ast-which-crushes-json-xml-yaml-...</a> and <a href="https:&#x2F;&#x2F;github.com&#x2F;nin-jin&#x2F;tree.d">https:&#x2F;&#x2F;github.com&#x2F;nin-jin&#x2F;tree.d</a>.
mifydev4 个月前
That&#x27;s fun! I also want to participate, here&#x27;s my application for configuration languages competition #927 — Typeconf. We like the idea of adding types to configs, but why should everyone introduce their DSL, just use Typescript!
jjulius4 个月前
With the handful of threads about electronic music in the past couple of weeks, for a brief moment I thought this was going to be about the inimitable CCL[1].<p>[1] <a href="https:&#x2F;&#x2F;on.soundcloud.com&#x2F;CGSmV6qHWNXKhLcp8" rel="nofollow">https:&#x2F;&#x2F;on.soundcloud.com&#x2F;CGSmV6qHWNXKhLcp8</a>
herrington_d4 个月前
Calling other languages like &quot;none of the tooling&quot; in the &quot;why&quot; section sounds like a huge self-roasting since CCL does not have, say, highlighting&#x2F;LSP&#x2F;FFI for adoption.
azeirah4 个月前
If you want a category theoretically-informed configuration language that has real-world use, then use nix.<p>It&#x27;s precisely this, and there&#x27;s a reason it has the largest package repo on the planet
binary1324 个月前
This is silly. I like it. I’m pretty sure you just tricked me into reading a “for dummies” primer on category theory. Congratulations!
bobnamob4 个月前
I’m still sad there’s such an aversion to parens<p>Edn is a lovely config language that checks most of the authors boxes, while still being “composable”
jteppinette4 个月前
Is there a &#x2F;s missing somewhere?
hoseja5 个月前
You&#x27;d think people would be more disinclined to xkcd:&#x2F;&#x2F;927 but for some reason this keeps happening.
jalk4 个月前
&gt; You want to introduce data validation and type-checking in your config? Fine, you can just ask users to provide type annotations in the format you want...<p>No - the users cannot choose type - they cannot suddenly decide that they want to provide a date where your parser expects an URL, or you are suddenly just making users repeat the schema<p>&gt; Every software MUST WORK WITHOUT A CONFIG!! &gt; So, empty config or no config file at all must be a valid configuration<p>Loads of scenarios where I want fail-fast over a running but broken system: &quot;WARN AlertSystem URL not configured: alerting disabled&quot; &quot;WARN No credentials store configured, adding admin&#x2F;111111&quot; ....