File: stdlib.md

package info (click to toggle)
hare 0.24.2-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,756 kB
  • sloc: asm: 1,180; sh: 119; makefile: 116; lisp: 99
file content (66 lines) | stat: -rw-r--r-- 1,742 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Hare stdlib mandate

The Hare standard library shall provide:

2. An interface to the host operating system
3. Implementations of broadly useful algorithms
4. Implementations of broadly useful formats and protocols
1. Useful features to complement Hare language features
5. Introspective meta-features for Hare-aware programs

Each of these services shall:

1. Have a concise and straightforward interface
2. Correctly and completely implement the useful subset of the required behavior*
3. Provide complete documentation for each exported symbol
4. Be sufficiently tested to provide confidence in the implementation

\* This means read the RFC before you start writing the code

Some examples of on-topic features include:

## Language features

- Memory allocation
- High-level string manipulation (e.g. concat, replace, split)
- High-level slice manipulation (e.g. sort)
- Test harness and testing support code

## Introspection

- Hare lexing, parsing (and unparsing), and type checking
- ELF, DWARF
- Stack unwinding

## Operating system interface

- I/O support
- Filesystem access
- Sockets

## Useful algorithms

- Sorting, searching
- Cryptography
- Hashing
- Compression
- Date & time support
- Regex

## Useful formats & protocols

- Internet protocol suite
- INI
- tar, zip, cpio
- MIME

# Conventions

See also the [Hare style guide](https://harelang.org/style/)

1. Tagged unions should be written from most to least common case, which
   generally puts the error cases last.
2. Prefer to design APIs which avoid allocation if it can be done without being
   at the expense of good API design.
3. Whatever the semantics, document the allocation and lifetime behaviors and
   expectations of each function to which they apply.