From a2ef71500a38ead316fe4b10aa17137e12b91ced Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Tue, 19 Jan 2021 08:53:18 -0600 Subject: [PATCH] updating documentation --- CHANGELOG | 6 ++---- core/alloc/pool.onyx | 11 +++++++++++ docs/plan | 2 +- docs/todo | 16 ++++++++-------- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5c831d99..2b6e5304 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ Additions: it will work on many systems. ARM / PowerPC may not work correctly. * procedures can be polymorphic on an array size. * structures can be polymorphic on any compile-time known value. +* procedures can be polymoprhic on any compile-time known value, including type expressions. * basics of operator overloading using `#operator +`. * multiple return values and multiple assignment / declarations. * #solidify directive for explicitly specifying type variables in polymorphic procs. @@ -15,12 +16,9 @@ Additions: * '-VV' and '-VVV' for very verbose printing. Easier to nail down compiler issues because it stops printing in the entity where the problem is. * `io.Stream` API with `io.Reader` and `io.Writer`. -* `map.empty` -* `string.compare` -* `array.copy` * ranges on switch cases, i.e. `case 4 .. 10`. Note, this is inclusive on the upper end, unlike most other uses of the range literal. -* `map.update` +* miscellaneous core library functions Removals: * struct literals can no longer specify values for members brought in through a `use`. diff --git a/core/alloc/pool.onyx b/core/alloc/pool.onyx index 4abf6a5f..1f1e51ac 100644 --- a/core/alloc/pool.onyx +++ b/core/alloc/pool.onyx @@ -1,5 +1,16 @@ package core.alloc.pool +// A pool allocator is an O(1) allocator that is capable of allocating and freeing. +// It is able to do both in constant time because it maintains a linked list of all +// the free elements in the pool. When an element is requested the first element of +// linked list is returned and the list is updated. When an element is freed, it +// becomes the first element. The catch with this strategy however, is that all of +// the allocations must be of the same size. This would not be an allocator to use +// when dealing with heterogenous data, but when doing homogenous data, such as +// game entities, this allocator is great. It allows you to allocate and free as +// many times as you want, without worrying about fragmentation or slow allocators. +// Just make sure you don't allocate more than the pool can provide. + PoolAllocator :: struct (Elem: type_expr) { buffer : [] Elem; first_free : ^Elem; diff --git a/docs/plan b/docs/plan index 1bb0d442..1cd88288 100644 --- a/docs/plan +++ b/docs/plan @@ -41,7 +41,7 @@ HOW: - struct member names - array length - [ ] baked parameters + [X] baked parameters - Compile time known parameters - Removes the argument from the list and replaces the function with the baked function diff --git a/docs/todo b/docs/todo index de52372a..5d0dc479 100644 --- a/docs/todo +++ b/docs/todo @@ -160,16 +160,16 @@ Usability: [ ] Make compiler work on MacOS [ ] Make Onyx easier to use from JS [ ] Add examples for the following language features: - - Slices - - Dynamic Arrays - - Structs and unions - - Enums - - switch statements - - for loops - - Maps + ✔ Slices + ✔ Dynamic Arrays + ✔ Structs and unions + ✔ Enums + ✔ switch statements + ✔ for loops + ✔ Maps + ✔ pipe operator - varargs - `use` keyword - ✔ pipe operator - Overloaded procedures - Polymorphic procedures - WASM directives (#export, #foreign) -- 2.25.1