The Cone Programming Language
The Guide#
- Hello, Cone
- Variables, types and expressions
- Blocks and conditionals: if and match
- Loops: while and each
- Functions, closures and generators
- Numbers
- String
- Tuples: several values at once
- Structs: named fields and methods
- Enums: one of several kinds
- Collections: what every collection shares
- List: values in a row that grows
- Dict: finding a value by its key
- Actors
- parallel each
- Growing a program with Congo
Memory management#
- Borrowed references
- Permissions
- Lifetime annotations
- Borrowing into a collection or an enum
- Regions and owning references
- When a value dies: the order of finalizers
- Reference counting
- Weak references
- Lock permissions
- Arenas
- Pools
- Garbage collection
- Collections in a region
- Making your own region
Concurrency in depth#
- Actors in depth
- parallel each in depth
- What may cross a thread: Sendable and Shareable
- await and futures in depth
- I/O from an actor: awaiting sockets, files, timers and HTTP
- The I/O loop underneath: iocore and the I/O thread
- How the runtime works
- The GPU: compute kernels
- OS threads and channels
- Roll your own: atomics, the futex and locks
Modularity#
- Modules: files, submodules and imports
- Public and private: what a module shows
- Packages: modules compiled and shared on their own
- Global state: constants, globals and initialization
- Name folding: delegation, reuse and extension
- Subtyping: when one type can stand in for another
- Traits: interchangeable parts
- Function and closure references: behaviour as a part
- Generics and macros: one template, many versions
Safety and the boundary with C#
- Type safety: coercion and conversion
- Panics and assert: when a program must stop
- Calling C: extern and @c
- Raw pointers: *T
- trust: when you know better than the compiler
- Inline and pure functions
- Platforms and targets
- Intrinsics: what library code asks of the compiler
Recipes#
- Method patterns: what a struct can become
- Moves: values there can only be one of
- with blocks: working on one value
- Patterns of your own: using
- Generators: writing your own