3 ms·
I mean, that seems ugly to me, but... Makes intuitive sense and is fine actually? Is HTML a rich language in which to embed stuff like this? No. Does this clear
by daeken 1y ago
I mean, that seems ugly to me, but... Makes intuitive sense and is fine actually? Is HTML a rich language in which to embed stuff like this? No. Does this clearly get the point across? Yes.
[Edit: this should've actually been attached to the GP comment. I agree with the parent.]
- hasanhaja 1y agoIsn't that the whole point of hypermedia frameworks like Datastar and HTMX? It's to extend the declarativeness of HTML. If you don't like the syntax, that's your preference. But I'm curious to hear why this is "wrong". Since that's a more objective thing, we can discuss it
- troupo 1y agoBecause it's a mish-mash of different ad-hoc DSLs. You have a DSL based on data-* attributes But then some attributes get this weird syntax-ish extension Then some of those attributes accept a Datastar expressions DSL: https://data-star.dev/guide/datastar_expressions https://data-star.dev/guide/datastar_expressions So you can have data-on-click__debounce.200ms="$landingGearRetracted && @post('/launch')" Which is just bad design
- jmstevers 1y agoWhat design do you think would be better?
- troupo 1y agoBoth Datastar and HTMX have the same issue: they want to pretend to be HTML. So they force themselves into writing several DSLs like this to pretend that this is still "just HTML". Since they have a full "Datastar expression" language, I'd just expand that. Then you wouldn't need these weird constructs: <button data-on-click__window__debounce.500ms.leading="$foo = ''"></button>
- jmstevers 1y agoWell they are both "just HTML", Datastar being better about being spec compliant using the dataset attributes and all. By expanding the "Datastar expression" language, do you mean a compiled language or moving all the expressions into JS files or something else?
- troupo 1y ago> By expanding the "Datastar expression" language, do you mean a compiled language or moving all the expressions into JS files or something else? Doesn't matter. They literally already have a Javascript-like DSL: https://data-star.dev/guide/datastar_expressions https://data-star.dev/guide/datastar_expressions
- sudodevnull 1y agoDatastar is spec compliant HTML. Please point me to the code that's not HTML spec compliant
- hasanhaja 1y agoI can see what you're saying. But again, the API design woes are subjective and I think it's perfectly fine to iterate on getting this to a nicer state. "Wrong" to me suggests a gap in the understanding of fundamentals or of how things work. If the ideas of Datastar are fine to all of us, and our issues with it are ergnomics, then that can be a more focused discussion.
- troupo 1y ago> But again, the API design woes are subjective They aren't. This is not good API design <button data-on-click__window__debounce.500ms.leading="$foo = ''"></button> > "Wrong" to me suggests a gap in the understanding of fundamentals or of how things work. Snide vaguely dismissive remarks don't make such remarks true. > If the ideas of Datastar are fine to all of us Who's us? Are these "us" in the room with us right now?
- hasanhaja 1y ago> They aren't. This is not good API design Why isn't it a good API design? > Snide vaguely dismissive remarks don't make such remarks true. Agreed! I don't believe I was doing anything of the sort. > Who's us? People on this thread.
- sudodevnull 1y agoWe are limited to what is possible in the data dash-* spec. If you have better syntax that's going to work everywhere in every browser please let us know!
- troupo 1y agoYou literally have a custom Javascript-like DSL already https://data-star.dev/guide/datastar_expressions https://data-star.dev/guide/datastar_expressions This wilful insanity is completely incomprehensible to me (HTMX and lit are also fully infected with it): "Oh no, we are just HTML, we can't do anything" while literally doing tons of things outside of HTML.