Skip to content

Latest commit

 

History

History
153 lines (128 loc) · 4.85 KB

TODO.md

File metadata and controls

153 lines (128 loc) · 4.85 KB
General-purpose COW arrays supporting an initial fixed-size memory buffer
======= General-purpose arrays supporting an initial fixed-size memory buffer
with compile-time support and optimized access (eg: bit-shifts instead of re-interpreting)

Explanation Examples
// Always dynamically allocated
Array<int>;
Array<int, 0zu>;
Array<int, HEAP>;
// Fixed-size buffer of `sizeof(…) == 3zu * sizeof int`
//   the default `Allocator …` does not allow
//   for further allocation once the buffer is at capacity
Array<int, 3zu, …>;

// — but `Allocator<HEAP>` and any non-default `Allocator`
//   may ignore said behavior
Array<int, 3zu, Allocator<HEAP> >;
Array<int, 3zu> fixed {1, 2}; // int[3] {1, 2, 0}
Array<int>      dynamic;      // int*

fixed.add(…);         // ❌ can’t add to a fixed-sized array
dynamic.add(1, 2, 3); // ✅ int (*)[3] {1, 2, 3}
Array<int, 3zu, Allocator<HEAP> > heaped;  // int (*)[3] {0, 0, 0}

heaped.add(1, 2, 3); // ✅ int (*)[6] {0, 0, 0, 1, 2, 3}
Traits that allow for compile-time arithmetic operations (intended for floating-point numbers)
// Needs better design
// → floating_point<true, 1zu, 0u>
operate::add<
  floating_point<false, 1zu, 0zu>,
  floating_point<true,  2zu, 0zu>
>::value;
Runtime interpreter which generates platform-specific machine code
Function function = {}; // → Function{ARM_64}

// Needs better design
function.addInstruction(…);

Function::addInstruction(INTEL_x86_64, function, …);
Function::addInstruction(function, …);
General-purpose mathematics library with common numeric constants & utility functions that work with generic types General-purpose memory allocator which supports special-purpose allocation strategies with compile-time support for block-based allocations
  • Allocator for platform-specific executable memory
  • Defaults dynamic memory management on the program heap
  • Pre-processed to contain __FILE__ and __LINE__ diagnostics
  • Provides the allocator interface for pre-reserved memory
Allocator<> allocator = {}; // → Allocator<byte, HEAP>
allocator.allocate(…);
// Allocates from the program heap
Memory::allocateHeap(…);
Memory::allocateHeap(…, EXECUTABLE | ZEROED);

// Allocates from an instantiated `static` buffer
Memory::allocateStatic(…);

// Likely wouldn't be developed
Memory::allocateStack(…);
Accessor/ mutator objects that allow for more expressive behavior when modified/ referenced
with compile-time support.

Akin to how constructors/ destructors allow for more expressive resource management with object lifetimes
class Array {
  public:
  property<unsigned, get, set> length;
};
Array array = {};

array.length;       // get(unsigned&, …)
array.length = 42u; // set(unsigned&, …, 42u)
$0;      // function(a) { return a }
$0 + $1; // function(a, b) { return a + b }
$0 + …; // function(a, …) { return a + … }
General-purpose strings supporting ASCII and Unicode-aware text (for cyrillic, CJK, and emoji support)
with compile-time support
Strings may be hashed as unsigned integers for quicker comparison

— see CopperSpice strings

// Inherits from `Array` since both can be SOO optimized
// — quantifies by code units, not by character type
// → String<…, UNICODE>
String<char16_t>; // Standard 16-bit codepoint string
String<char32_t>; // Standard 32-bit codepoint string
String<char8_t>;  // Standard 8-bit codepoint string
String<char>;     // Standard character strings (supports ASCII and Latin-1 (ISO-8859-1))
String<wchar_t>;  // Standard wide character strings