From 49a04fa5ac4d0b7c9c221601102051830b326f07 Mon Sep 17 00:00:00 2001 From: Araozu Date: Tue, 20 Feb 2024 05:53:38 -0500 Subject: [PATCH] Small changes --- md/learn/adts/union-types.md | 2 +- md/learn/classes/definition.md | 9 ++++----- md/learn/functions/declaration.md | 2 +- md/learn/functions/lambdas.md | 4 ++-- md/learn/index.md | 17 +++++++++-------- static/index.html | 8 ++++---- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/md/learn/adts/union-types.md b/md/learn/adts/union-types.md index 1ae7215..ae653b0 100644 --- a/md/learn/adts/union-types.md +++ b/md/learn/adts/union-types.md @@ -11,7 +11,7 @@ enum Suit Spades, } -let suit = Suit::Hearts +val suit = Suit::Hearts ``` diff --git a/md/learn/classes/definition.md b/md/learn/classes/definition.md index db5f896..0dba89a 100644 --- a/md/learn/classes/definition.md +++ b/md/learn/classes/definition.md @@ -8,7 +8,7 @@ Basically kotlin syntax. `new` not required, in fact, forbidden. ```thp -let dog = Dog() +val dog = Dog() ``` ## Simple class @@ -18,7 +18,7 @@ Why'd you do this tho? ```thp class SimpleClass -let instance = SimpleClass() +val instance = SimpleClass() ``` ## Properties & methods @@ -89,14 +89,13 @@ print(michifu.get_name()) With kotlin's `init` block. ```thp -class Dog(pub String name) +class Dog(val String name) { - Int name_length + Int name_length = name.length() init { print("Dog has been instantiated") - $name_length = name.length() } } ``` diff --git a/md/learn/functions/declaration.md b/md/learn/functions/declaration.md index 66ce732..2c16d0b 100644 --- a/md/learn/functions/declaration.md +++ b/md/learn/functions/declaration.md @@ -91,7 +91,7 @@ fun greet( print("Hello {name} from {city}!") } -greet(name: "John", from: "LA") +greet("John", from: "LA") ``` diff --git a/md/learn/functions/lambdas.md b/md/learn/functions/lambdas.md index cd983db..657f7c2 100644 --- a/md/learn/functions/lambdas.md +++ b/md/learn/functions/lambdas.md @@ -22,7 +22,7 @@ By default closures **always** capture variables as **references**. ```thp -val mut x = 20 +var x = 20 val f = fun() { print(x) @@ -44,7 +44,7 @@ fun(parameters) clone(variables) { ``` ```thp -val mut x = 20 +var x = 20 val f = fun() clone(x) { print(x) diff --git a/md/learn/index.md b/md/learn/index.md index 2bf17a6..10573db 100644 --- a/md/learn/index.md +++ b/md/learn/index.md @@ -16,20 +16,21 @@ If you want to learn the language, go to the learn section. ## Goals -- Bring static typing to PHP: Not just type hints, not use `mixed` for everything +- Bring static typing to PHP: Not just type hints, not just `mixed` for everything that isn't a primitive type. -- Avoid automatic type conversion. +- Generics & ADTs +- Avoid implicit type conversion. - Remove the inconsistencies in the language. -- Organize the stdlib. +- Organize the stdlib into modules. - Differentiate between Arrays, Tuples, Maps and Sets. - Create a **consistent** language. -- Create typings for popular libraries (like TS's `.d.ts`). +- Have typings for popular libraries (like TS's `.d.ts`). - Have a simple instalation and configuration (requiring just Composer). -- Ship a fast, native binary (written in Rust) (why use PHP when we can go native?). -- Sub 10ms watch mode. +- Ship a fast, native binary (written in Rust) (why use PHP when we can go **_blazingly fast_**?). - Support in-place compilation. -- Emit readable PHP code. -- Implement a LSP server. +- (Try to) emit readable PHP. +- Implement an LSP server. +- Implement a formatter. ## Not goals diff --git a/static/index.html b/static/index.html index e4db9f9..fbfbb49 100644 --- a/static/index.html +++ b/static/index.html @@ -62,17 +62,17 @@
                 
                     fun find_person(Str person_id) -> Result[Str] {
-                        let person_id = try person_id.parse[Int]()
+                        val person_id = try person_id.parse[Int]()
                         try Person::find_by_id(person_id)
                     }
 
-                    let id = POST::get("person_id") ?: die
-                    let person = find_person(person_id: id) ?: die
+                    val id = POST::get("person_id") ?: die
+                    val person = find_person(person_id: id) ?: die
 
                     print(
                         <a href="/person/reports/{person.id}">
                             Hello {person.name}
-                        </div>
+                        </a>
                     )