Version: v0.7.1 - Beta.  We welcome contributors & feedback.

Common Questions

Q: Why another programming language? And why PHP?

THT was inspired by the numerous compile-to-JavaScript languages (e.g. CoffeeScript, TypeScript, Elm) that were designed to fix problems in JS and provide a alternative interface for developers to work with.

This led me to wonder why there wasn’t yet a similar compile-to-PHP language, given how ubiquitous PHP is, and how many issues it has. I eventually decided to try to create one of my own.

Compiling to PHP meant I could build on the good parts — like the simple request model and fast Apache integration — and focus on providing a better developer experience.

Q: Why include a web framework?

One could say that PHP itself was originally a language + framework. That’s why, for example, templating is the default output mode and things like session support are built-in.

Somewhere along the line, it stopped exploring these web development features, leaving them to framework creators.

I believe that we now have enough knowledge about which web framework features are essential, that some of them can be included in the standard library.

Q: Isn’t PHP insecure?

PHP isn’t inherently less secure than other languages, but there are valid reasons why it has earned that reputation.

The biggest reasons that come to mind:

THT factors away the majority of PHP's security issues by default. It even goes further than many other languages, because it is designed to work in the hostile environment of the web.

Wherever possible, best practices are built in so that all programmers (novice or expert) can benefit.

Q: Is THT a compiler or transpiler?

It is a transpiler, which is a kind of compiler. “Transpile” and “compile” are used interchangeably in the docs.

The transpilation step takes place at request time and is cached, so it’s a transparent process. As a developer, you can just edit and refresh.

The definition of a transpiler:

A source-to-source compiler, transcompiler or transpiler is a type of compiler that takes the source code of a program written in one programming language as its input and produces the equivalent source code in another programming language.

A source-to-source compiler translates between programming languages that operate at approximately the same level of abstraction, while a traditional compiler translates from a higher level programming language to a lower level programming language.

Q: Why did you design $FEATURE in way that I don’t like?

See Design Notes.

Q: Why did you choose the name “THT”?

I played with probably over 100 names, but ended up with “THT” for a few reasons:

Q: What is the correct way to write “THT”?

Formally, it is “THT” — all uppercase.

In code, and in file extensions, it is lowercase “tht”.

Uppercase “THT” is preferred in casual writing, with the assumption that it’s easier for both humans and search engines to distinguish it from a typo for “th(a)t”.

Q: Is there a convention for THT-related project names?

I would recommend anything starting with “T-” or “Th-”.

You should probably avoid using the full “THT” in project names, to avoid confusion.

Q: What are you adding next?

Please see the Roadmap.