115 points · by todsacerdoti · 2y ago · 66 comments
Now it feel like helm but it’s j2 and outputs a directory of yamls with base and overlays in kustomization way. So they can be iverriden in gitops by sre if needed
As someone who doesn't write any Rust I'd like to understand this more. Is it the ownership model that makes trees weird? Is there something you guys do instead? I was working on an R-tree yesterday for something and I'm slightly surprised to read this but obviously Armin knows what he's talking about :)
The problem however comes when you want to reference the parent from a child. In the ownership/reference graph that would also count as an edge, and hence creates a cycle with the parent-to-child edge. There are workarounds like using weak reference counted pointers or indexes into arrays, but ultimately they don't offer the same ergonomics as other languages and it's better to design with only parent-to-child links.
Similarly getting a mutable reference to a leaf while parents have references to children is awkward
smarter sources: https://rust-unofficial.github.io/too-many-lists/ https://softsilverwind.github.io/rust/2019/01/11/Rust-Linked...
Sure you CAN write unmaintainable business logic spaghetti in your templates, doesn't mean you SHOULD (Most criticism appears to come from this angle).
Recently I started using JinjaX (https://jinjax.scaletti.dev/), which is weirdly amazing. I think the comparison on the homepage explains it quite well. It feels like what Jinja always should have been and and the multiple ways of doing the same thing converge into one syntax in JinjaX.
I really hope the project gains more traction.
I remember when the template engine that everybody in Python used was kid (precursor to genshi) which was XML based and looked a lot like vue/jsx does today. Back in the day people did not like it at all because designers found it hard to work with.
Now the situation is a bit different but what do I know where we land in 10 years. It feels like a constant cycle ;)
After reading JinjaX sample, I see the point. I would agree that it's much cleaner... If not for the fact he uses capitalized tags to distinguish between templates and html. I hate it. First off, it just throws me off, I cannot tell at the glance anymore where is the real text, and where is templating voodoo-magic. How do I find the source files fot layout and pagination? Right, I just have to know the convention. Second, it's remotely justifiable and can be attributed to a matter of getting used to only if it produces html. Templating engines are not restricted to html. It could be producing markdown, it could be producing XML. If only the author of this library restrained himself to be less funky and not introduce any ambiguous idioms, it would be pretty perfect. But as it is, I don't think I could use it.
When using Jinja with HTMX you also run into trouble that it doesn't nicely support partials. You could use the jinja_partials library but I just find JinjaX so much more pleasant.
…and impossible to understand and keep track of what goes where.
No, thanks. Components are a good idea, and no imports is a horrible idea.
This was awhile ago though. Maybe something changed and I should try it again
I've used Jinja a lot and always thought that it struck just about the right balance.
The docs are also way better than they used to be.
https://web.archive.org/web/20110727181325/http://jinja.poco...
Go templating on the other hand, that drove me bananas.
I’ve been using Django templates since 2006. Jinja was designed after Django templates of that era, fixing their most glaring problems. Don’t remember the exact year when I started using Jinja a lot. Maybe 2013.
For example, a pure existence of an {% include %} tag. People use it, implicitly passing many arguments to some other template. Which makes it very hard to understand and change later.
Macros are not that pleasant to use, there are less features in macros then in Python functions, and tools support is much worse too (static analysis, formatting, etc).
Filters… why do I need to write `value|string` instead of `str(value)`?
Etc.
Super slow parsing. Unintuitive DSL (opinionated enough to be a PITA). Huge LoC vs the value it contributes to your project.
Adopt a different system.. see: ERB, PHP, EJS- all of these are extremely fast and intuitive (just the native language + an extra tag or two).
Edit:
Of course.. this is authored by the jinja guy.
Sometimes it's the simple and dumb solutions that win out over the cleaner stuff. Nowadays maybe less so, JSX clearly won and if you build UIs today that's probably what you should go for. However there were many solutions like JSX a long time before and somehow the value proposition was not right for the software written at the time.