News for hackers. Stuff that matters.
Re:A look at modern PHP by MisterBastahrd on Tuesday May 05, 2020 @10:33AM (#23080403)
It's amusing to me to see all the hate for PHP, especially when the original lazy gripe was that people hated when faced with code that was mixed with templates. So completely different than the dominant modern front-end frameworks.
Re:A look at modern PHP by eropple on Tuesday May 05, 2020 @04:58PM (#23084984)
At least one of those front-end frameworks doesn't "mix code with templates", it represents HTML as code.

(It's for that reason that JSX is the first way-to-splat-HTML-out that hasn't made my skin crawl in...pretty much ever.)

Re:A look at modern PHP by ivanhoe on Tuesday May 05, 2020 @06:52PM (#23086062)
JSX just reverses the story, it's js with islands of html tags thrown in it instead of being html with code in it... in the end when you look at an average presentation component it's still like 90% html tags and some js mixed all together...
Re:A look at modern PHP by eropple on Wednesday May 06, 2020 @01:05AM (#23088055)
JSX is not, and I mean this emphatically not, "HTML tags". They're a tree of objects. That they sometimes represent HTML is orthogonal to why it's fantastic.

To elide all of the power and powerformance that JSX provides in the situations where it's appropriate as just "HTML tags" fundamentally misunderstands what they are and why they are powerful.

Data structures are more than text. This is a good thing.

Re:A look at modern PHP by slifin on Wednesday May 06, 2020 @03:32AM (#23088687)
JSX is data after compilation which means it's not as transparent or accessible programmatically in the same way hiccup is

That said I'm not sure it'd be as easy to do hiccup in pure JS because names aren't a first class data type there

Re:A look at modern PHP by seangrogg on Tuesday May 05, 2020 @06:41PM (#23085981)
GP could've easily been talking about the many other libraries/frameworks that DO use templating, though: Template Syntax in Angular/Vue, Glimmer in Ember, etc.
Re:A look at modern PHP by pdimitar on Tuesday May 05, 2020 @05:15PM (#23085143)
It's even more amusing how gross a generalisation you are making. I for one dislike PHP for all its little nasty surprises like implicit type conversion. Even 15 years ago I had zero problems with code and templates mixed in a file.