News for hackers. Stuff that matters.
Re:Astro is a return to the fundamentals of the web by diggan on Wednesday July 09, 2025 @08:40AM (#44509334)
> build a website or web app (or both) as a single, cohesive unit, covering both front-end and back-end, while avoiding the hydration performance hit.

Isn't that basically just what Symfony + Twig does? Server-side rendering, and you can put JS in there if you want to. Example template:

    <html>
        <head>[...]</head>
        <body>
            {% if user.isLoggedIn %}
                Hello {{ user.name }}!
            {% endif %}
        </body>
    </html>
The syntax is horrible, and seeing it today almost gives me the yuckies, but seems like the same idea to me, just different syntax more or less. I'm not saying it was better back then, just seems like very similar ideas (which isn't necessarily bad either)
Re:Astro is a return to the fundamentals of the web by zelphirkalt on Wednesday July 09, 2025 @11:43AM (#44511462)
I find that syntax more palatable than what is going on in JSX to be honest. I actually like having a separate declarative syntax for describing the tree structure of a page. Some languages manage to actually seamlessly incorporate this, for example SXML libraries in Schemes, but I have not seen it being done in a mainstream language yet.
Re:Astro is a return to the fundamentals of the web by diggan on Wednesday July 09, 2025 @01:04PM (#44512416)
Yeah, not a huge fan of either either to be honest, but probably JSX slightly before Twig only because it's easier for someone who written lots of HTML.

Best of them all has to be hiccup I think, smallest and most elegant way of describing HTML. Same template but in as a Clojure function returning hiccup:

  (defn template [user]
    [:html
      [:head [...]]]
      [:body
        (when (:logged-in user)
          [:div "Hello " (:name user)])])
Basically, just lists/vectors with built-in data structures in them, all part of the programming language itself.
Re:Astro is a return to the fundamentals of the web by zelphirkalt on Thursday July 10, 2025 @07:19AM (#44519719)
What you have written, that's what SXML is, basically.

Have a look at: https://www.gnu.org/software/guile/manual/html_node/SXML.htm... or https://docs.racket-lang.org/sxml/SXML.html

And as you say, part of the language itself, which means no need to learn something different, and no need to learn a pseudo-HTML or lookalike like with JSX, which then needs to be actually parsed by the framework (or its dependencies), unlike SXML, which is already structured data, already understood perfectly in the same language and only needs to be rendered into HTML.