Skip to content

Commit

Permalink
Replace all references to "class" with "type"
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickpeterse committed Dec 24, 2024
1 parent 62225c5 commit d430558
Show file tree
Hide file tree
Showing 32 changed files with 300 additions and 304 deletions.
2 changes: 1 addition & 1 deletion compiler/src/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl<'a> GenerateDocumentation<'a> {
doc.add("documentation", Json::String(docs));
doc.add("constants", self.constants());
doc.add("methods", self.module_methods());
doc.add("classes", self.types());
doc.add("types", self.types());
doc.add("traits", self.traits());

let path =
Expand Down
2 changes: 1 addition & 1 deletion docs/inko.pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require https://github.com/yorickpeterse/inko-wobsite 0.19.0 fa5e47733423aa6a902028e69de5a374a1757377
require https://github.com/yorickpeterse/inko-builder 0.13.0 7a38803e1fcd80e19ad2ea8fd90b9babf70e93a6
require https://github.com/yorickpeterse/inko-markdown 0.21.0 3726c10b499242cb3febc931a82e35217e2f987a
require https://github.com/yorickpeterse/inko-syntax 0.14.0 ef03ca1958a17560082495ec6367bd50b02d3fde
require https://github.com/yorickpeterse/inko-syntax 0.16.0 21cd93afb84c093c28bb3629e0b8b9441f6b1822
2 changes: 1 addition & 1 deletion docs/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"getting-started/control-flow.md",
"getting-started/variables.md",
"getting-started/methods.md",
"getting-started/classes.md",
"getting-started/types.md",
"getting-started/traits.md",
"getting-started/visibility.md",
"getting-started/modules.md",
Expand Down
6 changes: 3 additions & 3 deletions docs/source/design/compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The compilation process consists of the following steps:

Parsing is a topic extensively covered in computer science, so we won't go over
it in much detail. Inko uses a handwritten LL(1) recursive descend parser, and a
separate lexer/tokeniser. Each type of thing to parse (e.g. a class or an array
separate lexer/tokeniser. Each type of thing to parse (e.g. a type or an array
literal) typically has a corresponding function in the parser. AST nodes are
just plain structures.

Expand Down Expand Up @@ -325,8 +325,8 @@ refreshed automatically. Incremental compilation can be disabled using

### Methods

As part of code generation, methods are stored in a class such that we can
efficiently perform dynamic dispatch. Each class has a table for its method,
As part of code generation, methods are stored in a type such that we can
efficiently perform dynamic dispatch. Each type has a table for its method,
with the size being a power of two. Each method is given a globally unique hash
code based on its name. This means different methods with the same name share
the same hash code, but this is OK because a type can only define a method with
Expand Down
6 changes: 3 additions & 3 deletions docs/source/getting-started/arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The `get` method returns an immutable borrow to a value, while `get_mut` returns
a mutable borrow:

```inko
class Person {
type Person {
let @name: String
}
Expand All @@ -43,7 +43,7 @@ people.get_mut(0) # => mut Person(name: 'Alice')
If the index is out of bounds, `get` and `get_mut` panic:

```inko
class Person {
type Person {
let @name: String
}
Expand All @@ -56,7 +56,7 @@ The `opt` and `opt_mut` methods are similar to `get` and `get_mut`, except they
wrap the return values in an `Option` value:

```inko
class Person {
type Person {
let @name: String
}
Expand Down
16 changes: 8 additions & 8 deletions docs/source/getting-started/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ as these guides explain the basics of what we'll build upon in this guide.

To recap, Inko uses lightweight processes for concurrency. These processes don't
share memory, instead values are _moved_ between processes. Processes are
defined using `class async`:
defined using `type async`:

```inko
class async Counter {
type async Counter {
let @number: Int
}
```
Expand All @@ -27,7 +27,7 @@ Interacting with processes is done using `async` methods. Such methods are
defined like so:

```inko
class async Counter {
type async Counter {
let @number: Int
fn async mut increment(amount: Int) {
Expand Down Expand Up @@ -157,7 +157,7 @@ Here's a more complicated example:
import std.net.ip (IpAddress)
import std.net.socket (TcpServer)
class async Main {
type async Main {
fn async main {
let server = recover TcpServer
.new(IpAddress.v4(127, 0, 0, 1), port: 40_000)
Expand Down Expand Up @@ -190,11 +190,11 @@ isn't available.
When spawning a process, the values assigned to its fields must be sendable:

```inko
class async Example {
type async Example {
let @numbers: Array[Int]
}
class async Main {
type async Main {
fn async main {
Example(numbers: recover [10, 20])
}
Expand All @@ -217,7 +217,7 @@ methods:
```inko
import std.sync (Future, Promise)
class async Counter {
type async Counter {
let @value: Int
fn async mut increment {
Expand All @@ -229,7 +229,7 @@ class async Counter {
}
}
class async Main {
type async Main {
fn async main {
let counter = Counter(value: 0)
Expand Down
12 changes: 6 additions & 6 deletions docs/source/getting-started/control-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For conditionals we use `if`:
```inko
import std.stdio (Stdout)
class async Main {
type async Main {
fn async main {
let out = Stdout.new
let num = 42
Expand All @@ -32,7 +32,7 @@ Inko also supports `else if` like so:
```inko
import std.stdio (Stdout)
class async Main {
type async Main {
fn async main {
let out = Stdout.new
let num = 50
Expand All @@ -56,7 +56,7 @@ keywords:
```inko
import std.stdio (Stdout)
class async Main {
type async Main {
fn async main {
let out = Stdout.new
let num = 50
Expand Down Expand Up @@ -85,7 +85,7 @@ Here we use a conditional loop to print a number 10 times:
```inko
import std.stdio (Stdout)
class async Main {
type async Main {
fn async main {
let out = Stdout.new
let mut num = 0
Expand Down Expand Up @@ -121,7 +121,7 @@ import std.process (sleep)
import std.stdio (Stdout)
import std.time (Duration)
class async Main {
type async Main {
fn async main {
let out = Stdout.new
let mut num = 0
Expand All @@ -142,7 +142,7 @@ the inner-most loop:
```inko
import std.stdio (Stdout)
class async Main {
type async Main {
fn async main {
let out = Stdout.new
Expand Down
8 changes: 4 additions & 4 deletions docs/source/getting-started/destructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Types can define a method to run when before they are dropped, known as a
import std.drop (Drop)
import std.stdio (Stdout)
class Person {
type Person {
let @name: String
}
Expand All @@ -22,7 +22,7 @@ impl Drop for Person {
}
}
class async Main {
type async Main {
fn async main {
Person(name: 'Alice')
}
Expand All @@ -44,7 +44,7 @@ dropped escaping the `drop` call:
import std.drop (Drop)
import std.stdio (Stdout)
class Person {
type Person {
let @name: String
let @people: mut Array[ref Person]
}
Expand All @@ -56,7 +56,7 @@ impl Drop for Person {
}
}
class async Main {
type async Main {
fn async main {
let people = []
let person = Person(name: 'Alice', people: people)
Expand Down
Loading

0 comments on commit d430558

Please sign in to comment.