diff --git a/static/index.html b/static/index.html index d3f14fa..10399cf 100644 --- a/static/index.html +++ b/static/index.html @@ -13,10 +13,7 @@ - @@ -29,20 +26,40 @@ -
+ Inspired by Rust, Zig and Swift, THP has a modern syntax, semantics, + type system and stdlib. +
- Syntax, stdlib and types for PHP
-
- Written in Rust
-
- fun find_person(Str person_id) -> Result[Str] {
- val person_id = try person_id.parse[Int]()
+ // Actual generics & sum types
+ fun find_person(Int person_id) -> Result[String, String] {
+ // Easy, explicit error bubbling
try Person::find_by_id(person_id)
}
- val id = POST::get("person_id") ?: die
- val person = find_person(person_id: id) ?: die
+ val id = POST::get("person_id") ?? exit("Null person_id")
+ // Errors as values
+ val person = try find_person(person_id: id) with error {
+ eprint("Error: {error}")
+ exit("Person not found")
+ }
+ // First class HTML-like templates & components
print(
<a href="/person/reports/{person.id}">
- Hello {person.name}
+ welcome, {person.name}
</a>
)
+ // And more!