Live data from Hacker News

Marko – A declarative, HTML‑based language

markojs.com

71–80 of 189 posts

Re: Marko – A declarative, HTML‑based language

#71
post #60
post #57

Earlier quoted context omitted.

I mostly agree with you but React isn’t just JavaScript. JSX is not JavaScript. It’s just that we’re so used to it we don’t consider it notable any more. Worth keeping in mind when you’re looking at a brand new framework.

That's true, sure. My response to that is in React you have JavaScript & JSX and there are clear boundaries. It's not mixed. I don't write In JSX I write JavaScript that returns JSX: {data.map(node => )} ^ ----- JS ----^ ^ ------ JSX -------^ or const elements = data.map(node => ) ... {elements} Really the most obscure syntax there is the splatting but it makes sense to you when you realize that JSX is just syntactic…

There are of course libraries that use JSX and have '' components

Re: Marko – A declarative, HTML‑based language

#72

Maybe off topic, but I’d kill for a HAML for TSX or Svelte! Working with HAML really did make building web app fun IMO. I can’t be the only one!

Someone posted here, thanks for that!! It immediately reminded me of HAML: https://harcstack.org/

I like HAML a lot, it was the most pleasant to develop with. And it shares a lot in common with Stylus. They both shared things in common.

NO NEED FOR: Curly braces, parentheses and semicolons. The cool thing, it was all optional and I wasn't forced to make use of all shortcuts!

I developed my own CSS Framework in 2003, shared with some UX guy at Yahoo, who incorporated it into YUI mostly as is, after I waived all rights. Most of that became internet standard. Later I had my own PHP based CSS scaffolding framework in 2005 that could also generate grids (before flex-box). SCASS/LESS was really similar to my framework, when it came out.

But I disliked it, it just looked like PHP mixed with CSS. I thought why accept the ugly syntax, despite a compiler being available?

The best ever existed is: HAML + Stylus + (HARC?)

See the beauty of it: https://stylus-lang.com/docs/selectors.html

Now compare with HAML https://haml.info/

I think https://harcstack.org/ makes a good successor.

Re: Marko – A declarative, HTML‑based language

#73
post #60
post #57

Earlier quoted context omitted.

I mostly agree with you but React isn’t just JavaScript. JSX is not JavaScript. It’s just that we’re so used to it we don’t consider it notable any more. Worth keeping in mind when you’re looking at a brand new framework.

That's true, sure. My response to that is in React you have JavaScript & JSX and there are clear boundaries. It's not mixed. I don't write In JSX I write JavaScript that returns JSX: {data.map(node => )} ^ ----- JS ----^ ^ ------ JSX -------^ or const elements = data.map(node => ) ... {elements} Really the most obscure syntax there is the splatting but it makes sense to you when you realize that JSX is just syntactic…

I’ve never been a fan of JSX. I tried years ago and wasn’t super into it, and then Vue after that and found the syntax a lot easier on the mental model.

Re: Marko – A declarative, HTML‑based language

#74
post #68

I didn't look deep into Marko yet, but in my opinion JSX is by far the best HTML template language there is. And it's not restricted to React. Most other template languages hits serious limitations really fast. I tried and hated (for non trivial things): Angular, Handlebars, Razor (dotnet) and Vue (which does support JSX optionally).

Could you please try to be a bit more substantive with your comments?

E.g., Why do you think JSX is the best? What limitations did you hit with those other template languages?

Re: Marko – A declarative, HTML‑based language

#75
post #68

I didn't look deep into Marko yet, but in my opinion JSX is by far the best HTML template language there is. And it's not restricted to React. Most other template languages hits serious limitations really fast. I tried and hated (for non trivial things): Angular, Handlebars, Razor (dotnet) and Vue (which does support JSX optionally).

[deleted]

Re: Marko – A declarative, HTML‑based language

#76

previously: January 2023, 125 comments - https://news.ycombinator.com/item?id=34591625 August 2017, 150 comments - https://news.ycombinator.com/item?id=15057371 February 2015, 10 comments - https://news.ycombinator.com/item?id=9065447

Oh wow! So I guess Marko has been around for while. Despite that, this is my first time hearing about it.

Re: Marko – A declarative, HTML‑based language

#77
post #68

I didn't look deep into Marko yet, but in my opinion JSX is by far the best HTML template language there is. And it's not restricted to React. Most other template languages hits serious limitations really fast. I tried and hated (for non trivial things): Angular, Handlebars, Razor (dotnet) and Vue (which does support JSX optionally).

I've been liking the model of the Python library Dominate [1]. You write your HTML as regular Python code, and you render() once at the end, having full control over the formatting. Well, at least in theory; in practice the formatting is brittle and the library otherwise makes some choices I don't like.

I wrote a Rust library with a more restricted/verbose API, and I've been enjoying using that. Unfortunately, I find it really hard to make it as fast as I want. It's really the perfect use case for arena allocation, but doing that and keeping the API as function calls mirroring HTML is not trivial, and probably requires macros to rewrite the tree as a series of stack pushes.

1. https://pypi.org/project/dominate/

Re: Marko – A declarative, HTML‑based language

#79

Today is ${new Date().toDateString()} Random number: ${Math.floor(Math.random() * 100)} Sorry, I don't like it. I already disliked that immensely in PHP. Not going back to that spaghetti mesh-up. The intro is also incorrect in my opinion. It writes a "HTML-based language", but this is more a hybrid of HTML and JavaScript. Why is JavaScript not mentioned in the intro?

> I already disliked that immensely in PHP. Not going back to that spaghetti mesh-up.

That looks like a pretty normal template to me and nothing like plain PHP templates? What do you mean by "spaghetti mesh-up"?

Re: Marko – A declarative, HTML‑based language

#80
post #42

As someone who has actually worked on JavaScript frameworks, I think Marko is criminally underrated. The compile-time optimizations are extremely impressive: https://markojs.com/docs/explanation/fine-grained-bundling I was not surprised for example that Marko came out very well in this performance comparison: https://www.lorenstew.art/blog/10-kanban-boards

I remain convinced that RSC and the SSR craze was a result of someone (or multiple) people needing a raise and their friends wanting to start a company selling abstract compute. Statically hydrated, minimal React was pretty great when served over good CDN infrastructure. Then I watched the bundle sizes and lock-in balloon. That second article is a dragon slayer. It really lays out the problem with React. In marrying itself to Next.js and embracing the server, it's betrayed the platform. Meanwhile, the platform itself has matured. React practically built my career, and I just don't have a reason to choose it anymore.
Post reply on HN