aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: ee6d4a3f0cb77adef7cd1ec1110d46a438c1e7ba (plain) (blame)
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
# 🧚 puck - an experimental programming language

A place where I can make some bad decisions.

Puck is an experimental, memory safe, strongly typed, multi-paradigm programming language.
It aims to be clean and succinct while performant: having the ease of use of [Python](https://www.python.org/) with the performance/safety guarantees of [Rust](https://www.rust-lang.org/) and the flexibility of [Nim](https://nim-lang.org/).

You may judge for yourself if Puck meets these ideals.

## Why Puck?

Puck is primarily a testing ground and should not be used in any important capacity.
Don't use it. Everything is unimplemented and it will break underneath your feet.

That said: in the future, once somewhat stabilized, reasons why you *would* use it would be for:
- The **interop system**, allowing foreign functions to be usable with native semantics
- The **effect system**, being one of few languages with a proper effects system based on handlers
- The **type system**, being modern and powerful with a strong emphasis on safety and algebraic data types
- The **memory management system**,
- The **metaprogramming**, providing macros more powerful than Rust and on the level of Nim. You may operate directly on the abstract syntax tree either before or after typechecking.
- The **syntax**, aiming to be flexible, predictable, and succinct, through the use of *uniform function call syntax* and significant whitespace

## Why _not_ $LANG?

Why not Python?
- Python is slow and weakly typed, but with an excellent ecosystem and ergonomics.
- Puck is fast and strongly typed, and Python libraries are usable from Puck!

Why not Rust?
- Rust prioritizes performance and safety above all else.
- It then proceeds to prioritize ergonomics: but this can be *better*.
- Puck prioritizes safety, ergonomics, and performance, in that order.

Why not Nim?
- Nim is excellent and does many things right (in the view of the author).
- But it's held back by some technical debt: primarily around the C interop, which is functional but clunky. Puck, instead, compiles to LLVM and provides language interop through type system interop.
- Nim also puts much less of an emphasis on safety in the standard library. Functions may panic and throw exceptions: optional types exist but are scarcely used.

Why not Swift?
- Swift is functionally an Apple-exclusive language.

Why not Koka?
- Koka's focus is effect systems: Puck's focus is language interop.

## How do I learn more?

- The [basic usage](BASIC.md) document lays out the fundamental grammar of Puck.
- The [syntax](SYNTAX.md) document provides a deeper look into the syntax choices.
- The [grammar](GRAMMAR.md) document provides a formal grammar for Puck, which the parser is based upon.
- The [type system](TYPES.md) document gives an in-depth analysis of Puck's extensive type system, and its relationship to classes and other abstractions.
- The [memory management](MEMORY_MANAGEMENT.md) document gives an overview of Puck's memory model: which is considered a mashup of the models pioneered by Lobster, Rust, and Nim.
- The [effect system](EFFECTS.md) document gives a description of Puck's effects system: and how it ties into asynchronous code and exceptions.
- The [interop](INTEROP.md) document gives an overview of how the first-class language interop system works.
- The [metaprogramming](METAPROGRAMMING.md) document explains how using metaprogramming to extend the language and write more powerful code works.
- The [syntax](SYNTAX.md) document provides a more detailed look at the syntax of the language.
- The [modules](MODULES.md) document provides a more detailed look at imports and how they relate to the type system.
- The [roadmap](ROADMAP.md) provides a clear view of the current state and future plans of the language's development.
- The [standard library](STDLIB.md) document provides an overview and examples of usage of the standard library.
- The [extended library](EXTLIB.md) document provides an overview and examples of usage of the _extended_ standard library.
<!-- - The [asynchronous](ASYNC.md) document gives an overview of the intertwining of Puck's asynchronous support with other language features. -->

Note that all of these documents (and parts of this README) are written as if everything already exists. Nothing already exists! You can see the [roadmap](ROADMAP.md) for an actual sense as to the state of the language. I just found writing in the present tense to be an easier way to collect my thoughts.

## Acknowledgements

First and foremost, this language is _heavily_ inspired by Nim. Many ideas - general syntax, UFCS, even the design of the compiler - were taken 1:1. The memory management algorithm comes from Lobster (which is also implemented by Nim). Performance annotations are somewhat inspired by Nim. The underlying type system and use of is mostly copied from Rust with minor changes. The effects system is unique, with inspiration from the few languages successfully implementing effects systems, namely Koka and Unison.