3 ms·
I just rewrote our Caddy v2 Caddyfile formatter this week [1]. It's not as "smart" as a true code formatter, but what I thought would be just a 1 hour task ende
by mholt 7y ago
I just rewrote our Caddy v2 Caddyfile formatter this week [1]. It's not as "smart" as a true code formatter, but what I thought would be just a 1 hour task ended up taking all day. And I'm lucky it wasn't longer!
Lessons learned:
- State is hard. There's something to be said for functional languages, or at least functional patterns.
- The Caddyfile is a very theoretically-impure syntax.
- User input is always messier than you think it will be. (Spend some time helping people on the forums, you'll see what I mean. I'm a neat freak though, so I notice it...)
[1]: https://github.com/caddyserver/caddy/commit/7ee3ab7baa2165990d3fd358878d818154f7ee86 https://github.com/caddyserver/caddy/commit/7ee3ab7baa216599...
- pmarreck 7y ago> There's something to be said for functional languages, or at least functional patterns. Here’s my obligatory (and excellent) blog post by John Carmack where he adopts the functional style for a month: https://www.gamasutra.com/view/news/169296/Indepth_Functional_programming_in_C.php https://www.gamasutra.com/view/news/169296/Indepth_Functiona...