diff --git a/404.md b/404.md deleted file mode 100644 index da46775..0000000 --- a/404.md +++ /dev/null @@ -1,3 +0,0 @@ -# i did not find what you asked for - -have you considered learning how to type? diff --git a/README.md b/README.md deleted file mode 100644 index ad45d8a..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# nilstrieb.github.io - -hi diff --git a/_config.yml b/_config.yml deleted file mode 100644 index c419263..0000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/a-thing-about-provenance.md b/a-thing-about-provenance.md deleted file mode 100644 index 298302e..0000000 --- a/a-thing-about-provenance.md +++ /dev/null @@ -1,9 +0,0 @@ -true - -ref ref ref - -ptr ptr ptr - -ptr ref ptr - -mut diff --git a/cool-blog/ferrisclueless.png b/cool-blog/ferrisclueless.png deleted file mode 100644 index f72b4e3..0000000 Binary files a/cool-blog/ferrisclueless.png and /dev/null differ diff --git a/cool-blog/index.md b/cool-blog/index.md deleted file mode 100644 index 4d41a65..0000000 --- a/cool-blog/index.md +++ /dev/null @@ -1,8 +0,0 @@ -# cool blog - -yeah it's literally a really cool blog you should totally read it - -![img.png](ferrisclueless.png) - -hi -* [types](types-rust-ts-java) diff --git a/cool-blog/types-rust-ts-java.md b/cool-blog/types-rust-ts-java.md deleted file mode 100644 index 36fae38..0000000 --- a/cool-blog/types-rust-ts-java.md +++ /dev/null @@ -1,96 +0,0 @@ -# Types in Rust, Typescript and Java - -I find programming languages very interesting, but what I find even more interesting is comparing them -and seeing their similarities and differences. So let's do that! - -## Employees - -Say you want to build an employee management program. You could model the employees like this: - -```java -public class Employee { - public String name; - public int number; -} -``` - -> But using public fields in Java is bad practice? - -Go away, I don't care. - -```ts -type Employee = { - name: string; - number: number; -} -``` - -```rust -struct Employee { - pub name: String, - pub number: i32, -} -``` - -They look very similar, don't they? Sure, the syntax differs a bit and Typescript only allows floats (yikes) but they -feel like they are the same. - -Now we crate a function to print their names. - -```java -public class Employee { - public static void printName(Employee employee) { - System.out.println(employee.name); - } -} -``` - -> Why is the method static??? - -Because I decided so. - -```ts -const printName = (employee: Employee) => { - console.log(employee.name) -}; -``` - -```rust -fn print_name(employee: Employee) { - println!("{}", employee.name); -} -``` - - -Still nothing special. Time to call it! - -```java -Employee.printName(new Employee("nils", 1)); -``` - -> Assuming we have ~~written~~ auto-generated a constructor - -```ts -printName({ name: 'nils', number: 1 }) -``` - -```rust -print_name(Employee { name: "nils".to_owned(), number: 1 }) -``` - -> What are you doing with the `to_owned` on the string? - -Rust strings are complicated. - -Hmm, this is interesting. There is one big difference among the three calls: `{ name: 'nils', number: 1 }`. -The Typescript code is not saying that its creating an `Employee`, it's just creating some object. What does that mean? - -## Structural Typing - -That's because Typescript uses structural typing. To quote wikipedia: -> A structural type system is a major class of type systems in which type compatibility and -> equivalence are determined by the type's actual structure or definition and not by -> other characteristics such as its name or place of declaration. - -Structural typing means that the type checker only looks at the structure of the types to see whether they match, instead -of looking at the names (how Java and Rust do it). \ No newline at end of file diff --git a/index.md b/index.md deleted file mode 100644 index a87a8e3..0000000 --- a/index.md +++ /dev/null @@ -1,9 +0,0 @@ -## cool and fun blog - -i love how cool it is - -read [this](cool-blog) - -### Jekyll Themes - -Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/Nilstrieb/nilstrieb.github.io/settings/pages). The name of this theme is saved in the Jekyll `_config.yml` configuration file.