Live data from Hacker News

Show HN: I reinvented PHP in TypeScript (demo)

github.com

31–34 of 34 posts

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

#31
post #21
post #9

Earlier quoted context omitted.

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.

The issue is not the readability, it's that you don't handle how your stuff is sent. Using php as a template language, it starts to send everything until it reaches a Php tag to be executed.

That's why people taught each other that "you absolutely need to make session_start at the beggining of your file". No you don't, but since afterward the content starts to be sent the headers are already too.

I'm not saying you absolutely need to use a framework, but you should have only one echo in your requests.

I've never said the syntax you're saying is bad, I mean pretty much any templating language such has Twig uses this kind of stuff. The issue I have with this is how it works behind the scenes

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

#33

This project is cool but the author seems to have never actually touched PHP that he compares it to.

I studied it a long time ago — maybe it was even taught in college. Yeah, the comparison isn’t entirely accurate, but what I meant was the idea of merging code with its template plus rendering it all server-side right away.

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

#34
post #12

Interesting pattern. This is specially nice to me: "No build steps, no preprocessors, no complex configs". I worked on a project recently that followed this and Devs loved it. The DX was amazing.

Thank you, DX was really important for me in this project. I will add some examples and documentation in the near future, it will be cool. But writing README is very difficult for me =(

Well, I am sure that we need to develop the part with api. It already exists and works great, but lacks middlware functions and caching

Post reply on HN