4 ms·
<p>Today is ${new Date().toDateString()}</p> <p>Random number: ${Math.floor(Math.random() * 100)}</p> Sorry, I don't like it. I already disliked that immen
by shevy-java 11mo ago
<p>Today is ${new Date().toDateString()}</p>
<p>Random number: ${Math.floor(Math.random() * 100)}</p>
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?
- cyanydeez 11mo agoDon't blame Marko for this type of abomination. This is basically fancy react JSX. ITS just bizzare people want to parse JavaScript at the same instance they're parsing html. Also, LLMs are going to destroy any new framework. Someone's gonna need to figure out how to integrate these things into new tools. LLMs suck but it'll be much worse if they freeze innovations cause they're too expensive to chase the new hotness.
- Kiro 11mo agoYou two are complaining about different things. Note how the parent mentioned PHP as the reference.
- jamal-kumar 11mo agoI think the grand takeaway is that people like to complain
- whatshisface 11mo agoLLMs can make use of documentation and example code.
- cco 11mo agoHow would you prefer to write those examples?
- ethmarks 11mo agoPersonally, I'd either just put the content in an ID-ed span and have a script to replace the content. Another, perhaps better, way is to use Alpine.JS which excels at this kind of stuff.
- huflungdung 11mo ago[dead]
- ghurtado 11mo agoEither solution sounds more verbose than the example and require writing code in at least one other source file
- nine_k 11mo agoBut that separation is sometimes the point. A designer tweaking the looks has no chance to break the computation logic, and an engineer tweaking the computation part won't disrupt the design by mistake. Terseness is good for code golf [1]. I disliked CoffeeScript after writing it for some time: nearly any typo can result in another syntactically correct program which, of course, does not what you wanted the original program to do, or fails the compilation in an unrelated place. A practical language has safety margins, aka some redundancy. [1]: https://en.wikipedia.org/wiki/Code_golf#Dedicated_golfing_languages https://en.wikipedia.org/wiki/Code_golf#Dedicated_golfing_la...
- sorrythanks 11mo agoUnless the designer removes the id, or the engineer introduces new output that is not styled.
- ethmarks 11mo ago
- Lerc 11mo agoIs there any significant difference between that and element.innerHTML=` <p>Today is ${new Date().toDateString()}</p> <p>Random number: ${Math.floor(Math.random() * 100)}</p> ` (ideally .setHTML() when it's available) At that point I think I'd have a skeleton html file that fetches a JS that does it all. I'd take JS with embedded HTML over HTML with embedded JS.
- fooqux 11mo agoIsn't it wonderful that we live in a world where both ways can exist together, along with a myriad of other ideas for how to do the exact same thing?
- Kiro 11mo agoThe point is that both ways contain the same "spaghetti" that the OP is complaining about and that it's unclear what alternative they actually prefer.
- worik 11mo agoNo. But you can write dreadful code in any language
- marcelr 11mo agothis comment really proves that people do not consider the information presented to them marko is not comparable to php it is much closer to svelte i used to sympathize with people complaining about js-fatigue, but at some point its a skill issue
- jdmoreira 11mo agoMarko is server side. How is that closer to svelte?
- swiftcoder 11mo agoSvelte can also be used for SSR
- librasteve 11mo agop “Today is {Date.today}”, p “Random number: {(^100).pick}” Thought I would share this example as written in Raku using https://harcstack.org https://harcstack.org
- someothherguyy 11mo ago> 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"?