Hacker News new | ask | show | jobs
THT v0.2.0 – a language that compiles to PHP (tht.help)
20 points by jlesk 2930 days ago
5 comments

> a language that compiles to PHP

As I scroll through the page...

> familiar JavaScript like syntax

> provides a Perl module

From what depths of hell did this arise?

It's not a Perl module, but a perf module :)
Oops. That's what I get for skimming.
>You want a JavaScript-like language for server-side development, but without the complexity of Node.js

I think if node is too complex for you then perhaps you should find another career/hobby.

I've used Node for many years, but I do find it too complex for some of my projects.

Sometimes you just need a handful of dynamic pages that you want to put up on a shared host somewhere. PHP is great for that.

While I can appreciate the good intentions of the developers, for me, this just screams waste of effort. I can't see a way that this will ever gain widespread acceptance.

Can this even leverage the enormous PHP ecosystem? ie, composer, https://github.com/guzzle/guzzle, https://github.com/thephpleague/flysystem, etc.

From what I understand this targets developers who: A) Come from a javascript background and B) Want to deploy on cheap hosters where node isn't available? and C) Don't care about performance and don't mind the additional complexity of the transpiler.

Seems like a pretty small target audience.

Hi, thanks for your feedback.

I can understand that it might not seem useful to you if you already have a stack you've invested in, or it just doesn't fit the kind of projects you are working on.

But I just wanted to respond to a few things. :)

> A) Come from a javascript background

It targets all web developers, who are all generally familiar with JavaScript. It aims to be another tool, not a total replacement for all projects.

> B) Want to deploy on cheap hosters where node isn't available?

Shared hosting is still a very popular way to run websites. And node is often overkill for basic CRUD sites.

> C) Don't care about performance

There is a big difference between not needing to support 100+ requests per second and "not caring". :) Out of the box, PHP is fast enough for a lot of apps, and the overhead of THT is not enough to be noticeable at that scale.

> don't mind the additional complexity of the transpiler

There are no build steps, so the extra complexity just involves running the initial setup script. After that, you drop in new files and update them like you would with PHP. Ideally, it won't feel more complex than any other framework.

> Can this even leverage the enormous PHP ecosystem?

This is on the roadmap. Though there are still plenty of projects that don't use 3rd party libraries and could be built with THT as it is today.

I personally have never needed to use composer, etc. in my projects, but it's still something I am looking to support.

Thanks!

Thanks for the response.. Wish you nothing but the best...

My comment about complexity in the transpiler is more about debugging and what do you do when you can't figure out where your bug is, because it's in the transpiler. ;)

And I think your last sentence regarding composer makes it clearer whom this is aimed at.

Again, best of luck..

This looks like a great transitional framework for people who need to support existing PHP code or infrastructure and aren’t ready to make the jump to React just yet.
I'm curious as to the design decisions behind the THTML[1]. Some of them, like the double or triple arrow tags seem like they are going to be confusing in practice. It becomes a constant question or intent or typo (at least in my mind).

[0] https://tht.help/reference/thtml

Double-arrows let you signify that the tag is different with no extra effort because it's just an extra tap where your finger is already positioned.

It also has a right directionality to imply that it has scope until the end of the line.

Triple-arrow is the same idea, but uses the convention that triple-characters are common for delineating multi-line blocks.

I get that it is convenient but it just seems like the syntax is prone to unexpected behavior from typos.