News for hackers. Stuff that matters.
Re:Maud: A Rust macro for writing HTML by rbanffy on Tuesday June 07, 2022 @05:34AM (#31651814)
> One of the huge advantages of Maud is that it keeps code and markup close together

I'd say it's actually a disadvantage. Front end engineers will work with HTML with embedded logic (as little as possible - values, iterators, conditionals). Generating HTML from Rust code is nice for simple things, but won't work with complicated HTML templates when those are required and will be harder to integrate with front-end applications. It's possible to compile a template with embedded logic (Java Server Pages did that in the late 1990's) to performant and type safe code. An approach like that would be great for Rust (someone must have done it by now)

Re:Maud: A Rust macro for writing HTML by zaarn on Tuesday June 07, 2022 @05:39AM (#31651837)
My projects have no front-end engineer, however. The frontend is written in Rust as well and also uses Maud for HTML templating.

And I dispute it not working with complicated HTML templates, that's handling it fine and integrates very well since I share code between frontend and backend anyway.

Re:Maud: A Rust macro for writing HTML by rbanffy on Tuesday June 07, 2022 @05:43AM (#31651875)
I get that, but Maud is not the first of its kind and the absence of similar engines in web development is a telltale sign it's not the optimal approach.
Re:Maud: A Rust macro for writing HTML by zaarn on Tuesday June 07, 2022 @05:47AM (#31651890)
Well, as mentioned, I've yet to find something that can replace Maud without sacrificing it's advantages (in-code inheritance, code-sharing and compile-time type-safety).

So even if it's not the "optimal approach" as you title it, it's the ergonomic approach for me because it doesn't get in my way.

Re:Maud: A Rust macro for writing HTML by rbanffy on Tuesday June 07, 2022 @07:11AM (#31652450)
For these requirements, it's indeed a good choice. It's just not a use case I've seen often.