Live data from Hacker News

Show HN: I reinvented PHP in TypeScript (demo)

github.com

21–30 of 34 posts

Re: Show HN: I reinvented PHP in TypeScript (demo)

#21
post #9
post #3

My naive question: so if I have node, express, and JS tagged template literals. Is not that what PHP does. Route some url to a html interpolated with code. What is the add-on from this library? The only thing I read out of it, is some css and other templating benefits. Which is not the essence of PHP. The essence of PHP is that you mix html and code (which many JS tagged templates support). This goes more in the dire…

php has not been "mix html & code" for the last 10 years if you use it properly

No it's still proper to mix html and php code. You could always use a templating language like smarty 20 years ago so if it wasn't proper 10 years ago it wasn't proper 20 years ago. The truth is is very readable.

Re: Show HN: I reinvented PHP in TypeScript (demo)

#24
Not really. That implies that you’re running each HTTPS call as a lifetime process that starts and ends with that request, and the entire body of the JavaScript file, beginning to end is HTML with subtrees of the document including optionally some JavaScript that is synchronously run.

Respectfully, this doesn’t look anything like that at all.

Re: Show HN: I reinvented PHP in TypeScript (demo)

#25
post #5

I think this misses one of the main selling points of PHP, the shared nothing, single thread, fire and forget methodology that I can throw behind a load balancer and spin up 100 servers.

You can probably use something like https://www.cgi-node.org/ to get close to the PHP model in the JS world. But, I wouldn't be surprised if its slower than PHP due to the overhead of starting up NodeJS for each request, as PHP has been optimised to have fast start times.

This project is suggesting Deno, which has rather different startup characteristics to Node, and tuned for Deno Deploy which is already a "serverless" scale-to-zero/scale-as-many-as-you-need-behind-a-load-balancer deployment host. Deno Deploy is a proprietary solution, of course, but not alone in the growing world of JS-based "serverless" (Netlify, Vercel, Cloudflare Edge, and more).

Re: Show HN: I reinvented PHP in TypeScript (demo)

#26
post #7

Earlier quoted context omitted.

Modern PHP is not a templating language. It can be, much like many other languages can be, but it's not how it is used. Most other languages also implement their own templating languages. Have you seen modern PHP ... I don't know, sometime in the last 10 or so years, or is this just another circle jerk of hating on something you have little clue about? Now if you see that as a bad thing, separating business logic and…

> Modern PHP is not a templating language. It can be Modern PHP has the same capabilities as PHP 5 had, and more. There was nothing fundamental removed from the language that keeps it from being used as it was in PHP 5.

It didn't seem like they were suggesting otherwise?

Re: Show HN: I reinvented PHP in TypeScript (demo)

#28
post #2

So this is supposed to be following the practices that were common in PHP ten years ago? Modern PHP is not written in such a way where business logic is mixed with templating. For good reason.

Not everything is a big web app. Applying this separation of concerns to everything, and assuming everything will scale into Facebook, brings a lot of needless complexity into what should be simple little pages. Old PHP was great at that, and still is. I’m continually shocked that it has seemed to be the only game in town for decades. It seems like such an obvious use case. Maybe this is a testament to how well PHP solve this space, despite catching a lot of flack online. Similarly to this project, PHP also started out of the developer’s need to manage his Personal Home Page, not large scale enterprise apps.

So many people talk about missing the old Internet and the virtues of the small web, and breaking free from platforms… then at the same time speak out against the tools that allow a person to start small and dip their toe into the water of web development, without needing to spend several months in a boot camp for a few lines of server side code.

Re: Show HN: I reinvented PHP in TypeScript (demo)

#29
post #26

Earlier quoted context omitted.

> Modern PHP is not a templating language. It can be Modern PHP has the same capabilities as PHP 5 had, and more. There was nothing fundamental removed from the language that keeps it from being used as it was in PHP 5.

It didn't seem like they were suggesting otherwise?

Not sure we read the same thing?

Re: Show HN: I reinvented PHP in TypeScript (demo)

#30
post #9

Earlier quoted context omitted.

php has not been "mix html & code" for the last 10 years if you use it properly

You mean that the general patterns that people implement when using PHP changed. The language hasn't changed in a fundamental way that prevents it from being utilized in this way.

Yes
Post reply on HN