stdlib.md (1742B)
1 # Hare stdlib mandate 2 3 The Hare standard library shall provide: 4 5 2. An interface to the host operating system 6 3. Implementations of broadly useful algorithms 7 4. Implementations of broadly useful formats and protocols 8 1. Useful features to complement Hare language features 9 5. Introspective meta-features for Hare-aware programs 10 11 Each of these services shall: 12 13 1. Have a concise and straightforward interface 14 2. Correctly and completely implement the useful subset of the required behavior* 15 3. Provide complete documentation for each exported symbol 16 4. Be sufficiently tested to provide confidence in the implementation 17 18 \* This means read the RFC before you start writing the code 19 20 Some examples of on-topic features include: 21 22 ## Language features 23 24 - Memory allocation 25 - High-level string manipulation (e.g. concat, replace, split) 26 - High-level slice manipulation (e.g. sort) 27 - Test harness and testing support code 28 29 ## Introspection 30 31 - Hare lexing, parsing (and unparsing), and type checking 32 - ELF, DWARF 33 - Stack unwinding 34 35 ## Operating system interface 36 37 - I/O support 38 - Filesystem access 39 - Sockets 40 41 ## Useful algorithms 42 43 - Sorting, searching 44 - Cryptography 45 - Hashing 46 - Compression 47 - Date & time support 48 - Regex 49 50 ## Useful formats & protocols 51 52 - Internet protocol suite 53 - INI 54 - tar, zip, cpio 55 - MIME 56 57 # Conventions 58 59 See also the [Hare style guide](https://harelang.org/style/) 60 61 1. Tagged unions should be written from most to least common case, which 62 generally puts the error cases last. 63 2. Prefer to design APIs which avoid allocation if it can be done without being 64 at the expense of good API design. 65 3. Whatever the semantics, document the allocation and lifetime behaviors and 66 expectations of each function to which they apply.