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.

Considering then abandoning JSX for structured YAML config

33 pointsby gervwykabout 1 year ago

6 comments

pointlessoneabout 1 year ago
Maybe a silly question, but if you have a programming language available why can’t you buld a native structure, validate it and serialise it to YAML/JSON/whatever completely skipping templating part?
评论 #39491612 未加载
评论 #39507128 未加载
zamalekabout 1 year ago
So long as you use only string keys you can completely replace YAML with JSON (i.e. you can write JSON to a YAML file). Just make a .d.ts for your config schema and you&#x27;re done.<p>Avoiding YAML is this way has saved my sanity on more than one occasion.
评论 #39492173 未加载
YouWhyabout 1 year ago
The most useful construct I am aware of that I wish became more popular in backend languages is strongly typed tree literals. (Introduced by Meta in Hack as &quot;XHP&quot;)<p>Consider this pseudocode expression:<p>:Div{Hello :Span(style=&#x27;bold&#x27;){world}} # expression type: HTMLDOMNode.Div<p>This is immensely powerful and saves a ton of time&#x2F;bugs especially when compared to the alternative of string interpolation.<p>I know somebody once did XHP on Python, but regrettably this work was abandoned.
zer00eyzabout 1 year ago
I read this.<p>I read it if only to glean why anyone would do this. I learned nothing of the sort of person who would use Javascript to structure a YAML config.<p>10 years ago this article would have been &quot;Used PHP for structured YAML config&quot; and there would have been a minor riot of people poking fun at the article writer for attempting such sillyness. (And I say this someone who still made my money on PHP 10 years ago).<p>We got soft somewhere along the way and stopped calling out silliness.
taspeotisabout 1 year ago
YAML = Yelling At My Laptop<p>nindent makes me yell especially.
j-kriegerabout 1 year ago
I am baffled that we as an industry landed on the concept of „code over configuration“, then went on to choose text based formats like yaml or json and consider it perfectly normal to write these by hand? Or even worse, we use bastardized in-file template strings to generate hopefully valid YAML in the end.<p>What‘s wrong with configuring our platforms with a <i>real</i>, perfectly working programming language? I think the author had a great point with the schema being disconnected from the configuration file, but he missed the big picture with JSX: JavaScript (or TypeScript) can be perfectly used to emit JSON. JS tooling works with .config.js files.<p>Why must I experience the living hell of helm charts and kubernetes configuration file templates, when I could just emit my config with my favorite programming language?
评论 #39490677 未加载
评论 #39490721 未加载
评论 #39504822 未加载
评论 #39490635 未加载
评论 #39490602 未加载
评论 #39494273 未加载
评论 #39490683 未加载